Tech Off Thread

11 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

How can you generate RTF/Word Documents in ASP.NET?

Back to Forum: Tech Off
  • User profile image
    sbc

    Are there free libraries that can be used to generate and modify Word or rtf documents in ASP.NET?

    If there are none, is serving html content as application/msword the only option (which would mean no images and limiting it to users of Word 2000 or later)?

  • User profile image
    Yggdrasil

    If you don't mind limiting it to Word 2003 and onwards, WordML is the way to go.

  • User profile image
    SimonJ

    Absolutely. You create your template document in Word, marking up with a Custom XML Schema where you want the data to go and save the file as Word XML document. Then your ASP.NET process can use XML tools to insert the data into the custom XML tags without having to automate Word at all.

    Note that this limits your files to opening with Office 2003 Professional, Professional Enterprise or stand alone Word 2003 as those are the only editions which support custom XML Schemas.

    All editions of Word 12 will support custom XML Schemas and be able to open Word 2003 XML documents.

    SimonJ

  • User profile image
    sbc

    Can't use that really, as then you would seriously limit the users.

    What I want to do is create a form that users can fill in and email back. I can get the formatting and target more with PDF, but it does not allow saving form information (with whatever reader the user has). The html-in-word trick loses formatting and you cannot embed images, but allows the user to fill it in.

    This of course I have to do using whatever is freely available (so cannot buy any server components).

    Can Works open Word documents generated in this way (html served as application/msword)?

  • User profile image
    SimonJ

    There is no current technology which allows you to create lightweight forms that a user can fill in off-line and email back for you to then extract the data. Everything so far is either too heavy or requires the user to be online.

    PDF Forms come close but they are not easy to set up, there are version problems with different readers etc out there (not all PDF readers can fill in or email forms) and extracting the information from the forms isn't as easy as it should be.

    Microsoft are getting close with InfoPath but that currently requires the InfoPath client to be installed which is expensive. Office 12, next year, will let you fill in an InfoPath form without the InfoPath client software but only if you are on-line to the relevant server.

    Most people with this sort of requirement will write a small, rich client application to gather the data off-line and then send the data back through email or web services. You send or let the user download the rich client app and it then automates the rest of the process.

    SimonJ

  • User profile image
    SimonJ

    Perhaps I should qualify that to say that there is no widely available current technology which does what you want.

    SimonJ

  • User profile image
    cygnusx

    Until Microsoft releases their DOCX converters you might be interested in Aspose Word ... I used their Excel and PDF generators on a project recently and found them to be quite usable, the Word generator seemed pretty decent too.

  • User profile image
    sbc

    Well Aspose does look good, but I can only use what is freely available (even can't use something that costs £1).

    It makes sense why there is a cost in doing this though - as generating the documents with a GUI (i.e. Adobe, Word) costs you.

  • User profile image
    johan_london

    What put you off from implementing your initial idea of doing your project with PDF?

  • User profile image
    sbc

    Actually I may do it both ways. Word if they want to fill it in then email, or PDF for printing off.

    The problem with the PDF way was that the form data could not be saved when the user had ACrobat reader.

  • User profile image
    Deactivated User

    Comment removed at user's request.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.