none
Using OpenXML to generate Word doc with repeatable sections populated from SQL Server RRS feed

  • Question

  • Hi,

    I have never used Open XML before and I found out that it will be perfect for my requirement of creating a word doc (with repeatable data sections) populated from SQL Server. The word doc will be launched from my asp.net (c#) web page. Is there a step by step process that I should follow to achieve this?

    Thanks!

    Friday, January 11, 2013 4:33 AM

Answers

  • Hi viperpr

    As far as I know, there's no "cut-and-dried" step-by-step set of code for you what need. Although it's possible that someone has posted something like this on the Internet, somewhere...

    The first place to get information on working with the Office Open XML file formats is OpenXMLDeveloper.org. You'll find introductory material there, forums and blogs that cover a wide range of technology.

    The material on MSDN centers mainly around the Open XML SDK (the topic of this forum). There's also a library reference which has, among other things, a set of "How to" articles: http://msdn.microsoft.com/en-us/library/cc850833.aspx

    These would contain the basic information you need (how to write text to a Word document and how to generate tables in a Word document)...


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, January 12, 2013 4:29 PM
    Moderator

All replies

  • Hi viperpr

    As far as I know, there's no "cut-and-dried" step-by-step set of code for you what need. Although it's possible that someone has posted something like this on the Internet, somewhere...

    The first place to get information on working with the Office Open XML file formats is OpenXMLDeveloper.org. You'll find introductory material there, forums and blogs that cover a wide range of technology.

    The material on MSDN centers mainly around the Open XML SDK (the topic of this forum). There's also a library reference which has, among other things, a set of "How to" articles: http://msdn.microsoft.com/en-us/library/cc850833.aspx

    These would contain the basic information you need (how to write text to a Word document and how to generate tables in a Word document)...


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, January 12, 2013 4:29 PM
    Moderator
  • The path you want to take is not an easy one. Just contrary, it is steep and you will have to learn a lot about Open XML and only after then you will have to forge different techniques to accomplish different solutions for e.g. repeating content for each item in a collection, handling new lines in values for placeholders (can be line break or a whole new paragraph). This is mostly a way better approach then using MS Word application automation (with Office COM interops) but a much harder one.

    You can also take a look at one of the 3rd party solutions. It is usually cheaper to buy an existing workable library/tool than creating a custom one yourself. There are also some other solutions on the market - just google a bit. Creating your own solution should be your last resort except if your requirements are special and no 3rd party solution can solve the problem you have.

    Wednesday, January 16, 2013 9:49 AM