none
Modifying the same Template Document according an XmlDocument Object programmatically RRS feed

  • Question

  • Hello all,

    i just begun working with Open Office XML technologies and need your help.

    What could be the best solution if i have to modify a template Document (created in word) with Nodes from a XmlDocument Object.
    The Template Document has paragraphs and table cells with placeholders like "enter your text here".

    My actual question is on addressing these dummy texts. How do i address a certain paragraph in a docx file for assigning it an InnerText value from my Data-containing XmlDocument?
    Since the SDK is avaible creating these paragraphs is not a problem but i have problems by addressing existing paragraphs.

    In my Programm the Data-containing XmlDocument is changing trough choices of the user. But not the structure of it. 
    I made a first prototype by calling the mainDocumentPart and selecting his "w:p" node trough a huge Xpath expression. This is not a stable solution because the template docx file could be edited so the xpath expressions wouldn't be valid anymore. 

    Do you have any tips ? Could you give me some links or examples of code ? 

    thank you for your interests.
    Koray.

    Wednesday, October 15, 2008 12:18 PM

All replies

  • It seems you are still using version 1 to find the paragraph elements.

    In the latest V2 CTP1 release, you can access the elements very easily with strong typed classes. Please refer to the HOWTO articles here: http://msdn.microsoft.com/en-us/library/bb491088%28office.14%29.aspx.

    -Xinxing

    xinxing
    Sunday, October 19, 2008 6:23 AM