Archive for Open XML

Repeating Content in Document Generation System that uses XPath Expressions in Content Controls

I recently received a very good request for an enhancement to this document generation system.  The request was for a “Repeat” control that works in a similar way to tables, but instead of putting child records into a table, the document generation system generates a repeating section of content.

To review, here is what the template document looked like in the last iteration of this document generation system.  Below, you can see a screen-shot of the template document.  Following that screen-shot, there is a listing of the XML file that contains the data that will be used in the document generation process.

  • The green oval in the template document contains the XPath expression that selects the XML elements that contain the data for each of the documents.  That XPath expression selects the Customer elements in the XML document (also circled with a green oval).
  • Then, having selected the records for documents, the XPath expression in the blue oval selects the child records for the rows in the table.  The context nodes for that XPath expression are the Customer elements selected by the XPath expression in the green oval.  The selected elements in the XML document are encircled by a blue rounded rectangle.
  • And then finally, the XPath expressions circled by red select the values to place in the cells in the table.  In the XML document, the first set of nodes selected by those XPath expressions are also circled with a red oval.

Template1

XML1

The Repeat construct is parallel to that of a table. The following template document is similar in structure to the above template document, except that instead of generating a table, it generates repeating content.

Template2

When generated with the above XML document, the first document in the generated document looks as follows. I have encircled the repeating content with green rounded rectangles:

GenDocs1

Of course, due to the recursive implementation, you can get really elaborate with this setup. You can, for instance have repeating content within repeating content, or conditional content that contains a table within repeating content, and so on.

Download: 12-02-21-Gen-Docs-XPath

Comments

New Paper published by Peter O’Kelly – Revisiting Open Document Format and Office Open XML: The Quiet Revolution Continues

Three years ago Peter O’Kelly wrote a paper titled, “What’s Up, .DOC? Open XML Formats, OpenDocument Format, and the Revolutionary Implications of XML in Productivity Applications.” That paper was a part of an industry-wide debate about Open XML and ODF. He has recently published a new paper that analyzes the current state of document formats.

This new paper, Revisiting Open Document Format and Office Open XML: The Quiet Revolution Continues, discusses:

  • The business value of standardized, XML based document formats
  • A brief history of Open XML and ODF
  • The 2008 Open XML ISO controversy, and the response to Peter’s “What’s Up, .DOC?” Paper
  • An assessment of current Open XML and ODF market dynamics
  • Current standards activity
  • Projections into the future

It is interesting reading for document format wonks.

Comments

Join us for a live web-cast on DocumentBuilder 2.0 on September 7 at 8:00 AM PST

Bob McClellan and I will be hosting a live web-cast on Sept 7 at 8:00 AM PST.  We’ll be demoing some new functionality in DocumentBuilder 2.0, discussing the future of PowerTools for Open XML and DocumentBuilder, and taking questions and comments about it.  We’d love to hear your feedback, as well as ideas for enhancements. And if we run out of stuff to talk about with DocumentBuilder, any Open XML topic or question is fair game.

So if, like me, you can’t think of anything more fun than getting online with some other geeks, and discussing interrelated markup, document composability, and the intricacies of Open XML WordprocessingML, please join us!

You can find all the details in this blog post at OpenXMLDeveloper.org.

Comments (7)

Fourth and Final Screen-Cast in Series on Adding/Updating the TOC in OpenXML WordprocessingML Documents

Whew!  I finished the fourth and final screen-cast.  In this screen-cast, I show how to use Word Automation Services to repaginate a document and update the table-of-contents.

Shows how to use Word Automation Services to populate the TOC

You can download the code that I present in this video from OpenXMLDeveloper.org.

Here is the complete list of screen-casts in this series.

Link

Summary

Screen-cast #1

Explains the markup of tables-of-contents. TOCs use field markup.
See Deep dive into OpenXML Fields for more info.

Screen-cast #2

Presents some sample code that shows how to insert TOC markup into a document.

Screen-cast #3

Shows how to use Word Automation to update the TOC.

Screen-cast #4

Shows how to use Word Automation Services to update the TOC.

Screen-cast #5

Shows how to use an AutoOpen macro to update the TOC whenever any document that contains a TOC is opened.

Comments

Links – August 17 2011

I’ve been posting some new content over at OpenXMLDeveloper.org, and somehow didn’t manage to post the info here.

I’ve posted the third (out of four) screen-casts around inserting / updating tables-of-contents.

Exploring Tables-of-Contents in Open XML WordprocessingML Documents (Part 3)

My goal is to get the fourth posted before the end of the week.

Update: Here is the complete list of screen-casts in this series.

Link Summary
Screen-cast #1 Explains the markup of tables-of-contents. TOCs use field markup. See Deep dive into OpenXML Fields for more info.
Screen-cast #2 Presents some sample code that shows how to insert TOC markup into a document.
Screen-cast #3 Shows how to use Word Automation to update the TOC.
Screen-cast #4 Shows how to use Word Automation Services to update the TOC.

The following screen-cast was in response to a specific query in the forums on OpenXMLDeveloper.org.  Even if you don’t care about speaker notes in an Open XML PresentationML document, you might be interested in watching this.  It shows my approach to researching Open XML markup.

Screen-cast: Remove Speaker Notes from an Open XML Presentation

The following screen-cast re-affirmed the truism: it takes more time to make a shorter screen-cast.  The following is 6:40 long.

New Screen-Cast: Short and Sweet Intro to DocumentBuilder 2.0

Comments (2)

Notes about the Microsoft Public License (Ms-PL)

I’ve had a few questions lately about how the Microsoft Public License works.

The text of the Ms-PL: http://www.microsoft.com/opensource/licenses.mspx

You can find a page on Microsoft.com that explains the Ms-PL in straightforward terms: http://www.microsoft.com/resources/sharedsource/communitysourcelicensing.mspx

Here is a StackOverflow.com question/answer page regarding the Ms-PL: http://stackoverflow.com/questions/1424307/how-does-ms-pl-license-work

Comments (2)

Second Screen-Cast in Series on Adding / Updating Tables of Contents in Open XML WordprocessingML Documents

I’ve just published the second screen-cast in this series on updating the TOC of a WordprocessingML document.  In the first screen-cast, I explored the markup around TOCs.  In this second screen-cast, I discuss the markup a bit more, and then introduce some code that makes it easy to add a TOC to a document.  This code will become part of the PowerTools for Open XML project.

As part of the definition of each TOC, you specify a set of switches that Word uses as instructions on how to construct the TOC.  This screen-cast discusses the TOC switches, and shows how to find out more about them from the text of the Open XML standard.

You can find the code that I discuss in this video on OpenXMLDeveloper.org.

Discusses WordprocessingML TOC markup, and introduces some PowerTools for Open XML code that makes it easy to add a TOC to a document.

Now, back to editing the third screen-cast in this series.  Looks as though there are going to be four.

Here is the complete list of screen-casts in this series.

Link

Summary

Screen-cast #1

Explains the markup of tables-of-contents. TOCs use field markup.
See Deep dive into OpenXML Fields for more info.

Screen-cast #2

Presents some sample code that shows how to insert TOC markup into a document.

Screen-cast #3

Shows how to use Word Automation to update the TOC.

Screen-cast #4

Shows how to use Word Automation Services to update the TOC.

Screen-cast #5

Shows how to use an AutoOpen macro to update the TOC whenever any document that contains a TOC is opened.

-Eric

Comments (2)

New Screen-Cast Series on Tables of Contents in Open XML WordprocessingML Documents

One issue that has been sorely lacking in content is that of adding / updating TOCs in WordprocessingML documents.  I’m starting a series of screen-casts around this issue, and I’ve just posted the first in the series.  The first video walks through the markup for a table of contents.  It explains how the TOC can (but is not required to) be in a content control, and why you would want to put it in a content control.  It discusses how fields in WordprocessingML are used to represent a TOC.  The video dissects field markup, and explains how fields can be nested (and always are nested in the case of a TOC).

Walks through the markup for tables in Open XML WordprocessingML

In the video, I reference three links.  Here are those links:

Open XML Package Editor Power Tool for Visual Studio 2010

Open XML Markup Simplifier Application

Deep dive into fields in WordprocessingML

The next video will be an introduction into some code that I’ve written for PowerTools for Open XML, which enables you to more easily insert a TOC into a document.

Update: Here is the complete list of screen-casts in this series.

Link

Summary

Screen-cast #1

Explains the markup of tables-of-contents. TOCs use field markup.
See Deep dive into OpenXML Fields for more info.

Screen-cast #2

Presents some sample code that shows how to insert TOC markup into a document.

Screen-cast #3

Shows how to use Word Automation to update the TOC.

Screen-cast #4

Shows how to use Word Automation Services to update the TOC.

Screen-cast #5

Shows how to use an AutoOpen macro to update the TOC whenever any document that contains a TOC is opened.

Comments

Introducing a new class for PowerTools for Open XML: TextReplacer

Recently I wrote some code that implemented search-and-replace for Open XML WordprocessingML documents.  I wrote that code for an Open XML developer who needed to implement that functionality using XML DOM, although with a different language than C#.  Because XML DOM is standardized, translating the code to another language and another implementation of XML DOM is relatively straightforward.

I want to introduce search-and-replace functionality in a CMDLET in PowerTools for Open XML, but I have been moving PowerTools code away from XmlDocument, so I rewrote the search-and-replace code using LINQ to XML, using a functional transform.  It was an interesting and fun project.  The video below introduces the TextReplacer class, and compares it to the code that I presented that uses XmlDocument.  It is an interesting comparison of imperative code (using XmlDocument) and functional code (using LINQ to XML).

You can download the TextReplacer class from this blog post (in an attachment at the bottom).

Introduces TextReplacer, which is LINQ to XML code that replaces text in WordprocessingML documents.

Comments (8)

Query Open XML Spreadsheets in VB.NET using LINQ

I’ve put together a screen-cast that shows how to query an Open XML spreadsheet using LINQ from VB.NET.  If you are using VB, this is a super-easy way to extract data from SpreadsheetML.

You can find the code at OpenXMLDeveloper.org.

Shows how to query an Open XML spreadsheet from VB.NET using LINQ

Comments

« Previous entries Next Page » Next Page »