Skip to main content

Latest Articles: MsWord


Data-driven document generation with Word 2007 and the Office XML File Formats: Part 2
Entry Date: May 2008 site: Blogs MSDN Rating:
keywords:ASP .net; ADO .net; XML; VB .net; Open XML; .net framework 3.0; Office; DataSet; DataReader; VS 2008; Visual Studio 2008; Ms Word;
Article Description:
I will show you how to create a server-side data-driven document generation application that will allow you to select a company name to generate a custom letter. The application will retrieve customer data from a SQL Server database and use the customer letter document template to build a new document that displays customer data based on a user selection.
Comments:

Office 2007 introduced the Open XML format.. . an open format but quite complex, to make things simplers you have the chance of separating layout from content by attaching a pure XML data file to the docx (word document) and map it with user control in your word layout (the only big limitations is that you can not use it for detail / table information :-().

This samples shows you how to open a docx, grab the XML data file embedded on the docx and replace it by another read from a database (SQL Server).

Very interesting sample, if you are using Visual Studio 2008 forget about the lines that tells you how to install .net fx 3.0 :-)

Click Here To Navigate to the Article

Completing the WordML spec
Entry Date: May 2008 site: codeproject Rating:
keywords:ASP .net; XML; Office; Ms Word;
Article Description:
The WordML spec will probably never be fully completed. But here is an attempt to extend the documentation where Microsoft is silent.
Comments:

Filling gaps from MS documentation, one of the most interesting is how to add images (jpeg, gif, ...) to a wordML document (Ms Word 2003 or higher).

Click Here To Navigate to the Article

Generating WordML Reports Using Templates and XPath
Entry Date: May 2008 site: Bean Software Rating:
keywords:ASP .net; XML; Office; DataSet; DataReader; Ms Word;
Article Description:
Reporting is an import part of almost any web-oriented application. A couple of ways is used to deliver reports to the end user. They vary from simple csv (coma separated values) file generation to expensive complex reporting solutions, such as Crystal Reports. Choosing the optimal solution you should pay attention to such aspects as solution price, ability for end-user editing of the template, ease of use for target audience, etc. One of such ways, delivering relatively cheap reporting solution with end-user editable templates is using WordML.
Comments:

Complete sample about how to generate Ms Word documents for Office 2003 or higher in a lite mode (to be used on ASP .net applications)

You will find here how to read from a Database (SQL Server) and dump the data into a WordML XML Template using XPath. Maybe a better approach could be to use XSLT

By the way, WordML is subset of Word, nothing to do with the big Open XML 2007 format

Click Here To Navigate to the Article

Overview of WordprocessingML
Entry Date: May 2008 site: repoio Rating:
keywords:ASP .net; XML; Office; XSL; DataSet; Ms Word;
Article Description:

This document describes the elements in the WordprocessingML Schema that are important to document developers and to application developers whose programs will read and write WordprocessingML documents. The text assumes that you have a basic understanding of XML 1.0, XML namespaces, and the functionality of Microsoft&174; Office Word. Each major section of this document introduces new features of the language and describes those features in the context of concrete examples.

In this document, you'll see how to:

  • Create a document with typical Word structures (paragraphs and sections).
  • Add typical document components, including lists, tables, headers, footers, and title pages .
  • Format your documents by specifying formatting at any level within the document.
  • Define and use styles.
  • Insert graphics, bookmarks, hyperlinks, and fields into your document
Comments:

WordML is a XML simplified subset of Ms Word, quite interesting to use as a lite approach to generate simple docs on web applications using XML + XSLT

It's a very similar approach to Excel's XMLSS BUT it won't run on 2002, it needs Office 2003 or higher.

This doc is a copy from a bunch of Ms links / doc, nice to read all in one page or print it

Click Here To Navigate to the Article

How to use ASP to generate a Rich Text Format (RTF) document to stream to Microsoft Word
Entry Date: May 2008 site: Support Microsoft Rating:
keywords:ASP .net; Performance; Office; Ms Word;
Article Description:
This article describes how you can generate Rich Text Format (RTF) files with ASP script and then stream those files to Microsoft Word. This technique provides an alternative to server-side Automation of Microsoft Word for run-time document generation.
Comments:

How to generate RTF files (compatible with Ms Word) without any kind of help, ... go wild at low level and generate lite solutions.

Do not forget that RTF is not complex, but is limited, and generating a complex layout will get in a lot of chunky tag code.

This sample is based on ASP 3.0 and VB 6.0 but can be easly ported to C# / VB .net, ASP .net

Click Here To Navigate to the Article

Use ASP.NET and Visual Basic .NET to Transform XML to RTF and Display in Word
Entry Date: May 2008 site: MSDN Rating:
keywords:ASP .net; XML; VB .net; Office; Networking; DataSet; Ms Word;
Article Description:
Summary: Learn different ways of converting XML data to RTF. XML is a flexible way of organizing and presenting data. RTF is a text-based format that encodes formatted text, document layout, and graphics. Converting XML data to RTF allows you to create useful documents easily and quickly from a wide variety of data sources. (15 printed pages).
Comments:

One of the most common mistakes that we developers tend to do is to try to port our nice automation libs to generate Word documents in a Windows forms application to a web application... AAAAHHH !!! Don't do that !! there is a Ms KB about this that tells you all the drawbacks and issues and even that is not supported by Ms

Here you have a lite option to generate word documents that can be opened by any Ms Word instance (200, 2003, 2007). It's based on .net / XML / XSL / RTF (rich text format)

Click Here To Navigate to the Article

Creating Invoice Reports using Open XML Format
Entry Date: May 2008 site: The Engine Room Rating:
keywords:XML; Open XML; Office; Ms Word;
Article Description:
Recently I was responsible for generating an Invoice report using Open XML format of Office 2007. The report was developed using Word 2007, Word 2007 Content Control Toolkit, VS.Net 2005 (.Net 3.0), and SQL Server 2005. Most of the data was dynamically added to the invoice report using content controls and XML data manipulation.
Comments:

Workaround to the issue of generating tables (details orders...) based on XML and content controls

"Hardcore" solution, going through the openXML format and adding rows to the table.

Click Here To Navigate to the Article

Working with Content Controls
Entry Date: May 2008 site: MSDN Rating:
keywords:XML; Open XML; Office; Ms Word;
Article Description:
Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls can contain content such as dates, lists, or paragraphs of formatted text. In some cases, content controls might remind you of forms. However, they are much more powerful, flexible, and useful because they enable you to create rich, structured blocks of content. Content controls also build on the custom XML support introduced in Microsoft Office Word 2003. Content controls enable you to author templates that insert well-defined blocks into your documents.
Comments:

How to create content controls programmatically, is coded on VBA but can be easily ported to VSTO code, don't need to waste time recording macros :-).

Click Here To Navigate to the Article

Content Controls
Entry Date: May 2008 site: Arouet Rating:
keywords:XML; Office; Ms Word;
Article Description:
A content control is, essentially, a container that enables you to store and act on different types of documento content.
Comments:

Nice sample chapter, it goes into details about Word 2007 and content controls.

It's more about how Office works at application level, but worth to read before starting inserting this controls via VSTO :-)

Click Here To Navigate to the Article

Dynamic production of repeating context controls by a WCF service
Entry Date: May 2008 site: Open XML Developer Rating:
keywords:WCF; XML; Open XML; Office; Ms Word; VSTO;
Article Description:
Due to my work as an ISV DE in MS, I had just recently been requested by an organisation to produce a small demo to demonstrate how the new custom xml parts could help them deal with an issue that is causing them trouble. More specifically, they have many client stores that produce documents based on local stored templates and client-based programs bearing logic on how to format/compile the document. As you can imagine, this architecture is difficult to maintain and more often than not causes inconsistencies between the documents produced by the various client apps.
Comments:

Interesting sample: how to workaround the limitation of content controls in Ms Word 2007 when showing repeated elements (table based layout, order lines, ...).

Is not an straight forward solution but at least you have a path to follow

Click Here To Navigate to the Article

Repeated Content Controls in a Table
Entry Date: May 2008 site: Codeplex Rating:
keywords:XML; Open XML; Office; Ms Word; VSTO;
Article Description:
I want to generate a template with a table and populate the table with some content controls perhaps on the top row of the table. I then want an XML file with a number of order lines in the data. Is there any way to add a single set of content controls e.g. OrderQty, ProductName, Price etc. and then get them to repeat for each order line in the XML data? or am I corrent in that this functionality is not yet supported?
Comments:

Office 2007 + Content Controls + XML seems to be a quite clean and nice solution. But... have you realized that you don't have available basic sample like generating invoices, order details...

This solution does not support out of the box auto generating content controls for tables or things like that. If you need to implement this you will have to implemented code to dynamically add content controls and map to the XML... pain in the neck

Click Here To Navigate to the Article

Page (1) Of 2 Next Articles >>