I want to know if it is possible using openxml RRS feed

  • Question

  • I have a word document generated from template. Template has header, footer, editable data fields, non editable content and dummy images. I convert a dataset to xml and use that as datatemplate in the Template file. There are atleast 10-20 datasets depending on the document requirements.

    Once the document is created from data from database, I would like to save an identifier somewhere in the document for future reference which will help me get the same data again. User can save the updated document with the changes he has made. He can make few changes to the document formatting like highlighting the text, coloring the text, changing font size, changing/adding an image in designated places, etc, including the header, where he can update a new logo etc.

    I would like to write an application using openxml sdk, that will

    • take the updated document as input
    • add new images or update exisitng images
    • update the new data from database
    • preserve the document formatting done by user, except any modifications done to the data from database, which will be updated in the previous step
    • give the output as document or pdf as final version of the document.

    Here are few questions

    • Is this scenario possible?
    • If yes please guide me to sample code/documentation that will help me
    • Which of the items/scenarios are possible/not possible

    Any help would be highly appreicated.


    Monday, April 5, 2010 5:11 AM

All replies

  • Hi pooranlive,

    Thanks for your question.

    I think most of your requirements could be achieved by the Open XML SDK except for save the output document as pdf. To accomplish the tasks, we suggest you using the Productivity Tool which could generate sample code. For example, if you want to update the data in the document, you could do the steps as follows:

    1.      Create an empty docx document, insert the data and save it, such as “source.docx”.

    2.      Update the data to the source docx and save it as “target.docx”.

    3.      Open the Tool; click "Compare Files" to compare the “source.docx” and “target.docx” files.

    4.      In the "File Comparison" tab, click "View Part Diff" to show the differences between the selected two parts.

    5.       Click “View Part code” to see the complete sample code on how update the data you need.

    More functions of the Productivity Tool could be referred in Forum FAQ Part2, which may be helpful to you. Other how to sample code and commonly asked questions could be found in Forum FAQ Part1 and Forum FAQ Part2.

    Hope this helps. If you have any question, please let me know.



    • Proposed as answer by Lu Zhang Thursday, April 29, 2010 7:10 AM
    Tuesday, April 6, 2010 8:22 AM