wordpress hit counter
GlossaryDocumentPart is null - WordprocessingML - Formats - OpenXML Developer

GlossaryDocumentPart is null

Formats

Discussions about working with different Open XML Formats

GlossaryDocumentPart is null

  • rated by 0 users
  • This post has 1 Reply |
  • 0 Followers
  • I was wondering about how to add Building Blocks through OpenXML SDK.

    After messing around with it a little I noticed that when I added Building Blocks to .dotx info about them went into word\glossary\document part of the file so I decided to add some info there.

    However when I try ussing this line

    document.MainDocumentPart.GlossaryDocumentPart.GlossaryDocument.DocParts.AppendChild<DocPart>(part);

    I always get a null reference on GlossaryDocumentPart. When I check the underlying XML there is a glossary folder with 5 .xml files.

    Is this GlossaryDocumentPart not the right thing?
  • OK please ignore this, it was a mistake on my behalf.

    The path to the dotx file was wrong but I didn't get an exception on the document open method because there existed a file in the debug folder (wich didn't have a glossary part).

    On another note, does the sequence of w:tags matter?
Page 1 of 1 (2 items)