User control based on contents in Word 2007 dotx RRS feed

  • Question

  • User99005015 posted

    Folks, here is the situation, any help will be greatly appreciated:

    1. I have a dotx file which is basically a checklist with a bunch of check-boxes and a few text-boxes.

    2. I would like to programmatically create a user control page (a web form) located on a server based on the content in this dotx file. The layout and contents of the dotx file must be preserved. I would like to do this because the dotx file will be edited by people who have no coding knowledge.

    3. Website users can fill out the web form, and upon clicking save, a docx file with all the contents they typed in will be generated.

    4. I'm familiar with ASP.NET and C#.

    I would imagine that I'll need to parse the xml files in dotx file, and then create the proper ASP.NET controls accordingly. And then after the user fills in the web form, transfer the data to a docx file, again using open xml.  Any clue how to do this?

    Thank you guys in advance for any direction and help...

    Friday, May 28, 2010 2:35 PM

All replies

  • User-364289655 posted

    Sounds like a cool idea. You've definately got the correct idea. 


    1. Step one - read the docx ( http://msdn.microsoft.com/en-us/library/aa338205.aspx).

    2. Step two - decide how you're going to store the information to later generate a form of some kind. There are a lot of options here - if these are going to be heavily resused, you might consider storing them in a database (I've never done anything like this so i'm just going off the cuff here) - perhaps a Forms Table that stores meta data - name, description, and Id, then a questions table that stores Questions, FormId, FieldType. From here you could then generate these things on the fly when they request a certain type of form, and then when they fill them out you could add some table stuctures to store the data, OR you could output them directly into docx and let the user download it, without saving the values in the db.

    An alternative could be to read in the docx and actually generate an ascx control something like "MyFormName.ascx", output that to some folder. Assuming you use dynamic compilation, this should get picked up. This would be trickier imo, but you'd get much better performance loading forms

    Hopefully that gives you some direction


    Saturday, May 29, 2010 12:21 AM