What is OpenXML SDK?

  • OpenXML SDK is a simple .NET dll file and associated XML document.
  • ' The Open XML SDK 2.5 Productivity Tool for Microsoft Office' is a .NET GUI application to view the document contents in tree structure and generate the code based upon contents.
    • Automatically generate Open XML SDK code based on document content. User will be able to directly copy, compile and run the code to re-generate the same document or specific parts of the documents.
    • Compare two documents and list the differences in the document part structure as well as the content difference inside the parts.
    • Automatically generate Open XML SDK code based on the content differences between two documents. User will be able to copy, compile and run the code on the source document to generate the target document.
    • Validate a document, part of a document or a segment of content inside a part against Office 2007, Office 2010, or Office 2013
    • Provide documentations on the following:Open XML SDK Reference
    • ECMA376 v1 Open XML File Formats standard
    • Microsoft Office implementation notes (which document the implementer notes between the ECMA376 v1 and Microsoft Office 2007 SP2 implementation)

The ' The Open XML SDK 2.5 Productivity Tool' can open below following types of documents:

  • Word documents: .docx, .docm, .dotx, .dotm
  • Excel documents: .xlsx, .xlsm, .xltx, .xltm
  • Powerpoint documents: .pptx, .pptm, .potx, .potm

The .docx files are simple zip files. You can just rename the file to .zip extension and unzip the file to view the folders and files.

In order to mail merge the data to the document, the code has to replace the mailmerge fields with actual data. The sample difference between the original document and the merged document is as shown below.

  • Merge fields contains list of fldchar tags.
  • Starts with fldchar tag with attribute type="begin".
  • It can contain multiple fldchar tag with attribute type ="preserve". The combined text will provide the meta data information of the field.
  • In between separate and end, list of field codes which has text.
  • Ends with fldchar tag with attribute type="end".

In order to mail merge, just remove all these fields and insert a new text filed with the data from the database.

I will explain the code in subsequent posts.