Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    15

    Question Unanswered: Data export to user defined Word or Excel template

    Hi all,

    I would need to know how to fill an XLS or DOC template document with data using ASP.NET.

    Currently I am migrating my application form Access ADP/SQL Server to ASP.NET frontend. In Access I was using the following scenario

    1. User defines a document template for Letter, Fax, Invoice etc. in Word. Fields that are going to be replaced are marked with tags like <Customer>, <Address>, <Zip>
    2. The document is saved and moved into a common location on a network drive. (Will be probably SQL Server in new version)
    3. When exporting data, Access opens the requested template and does Search and Replace of the tags using COM automation (Not available in ASP.NET). When generating a serial letter (like Invitation) every template page was copied and filled in a loop so the resulting document could have many pages.

    The goal of this procedure was that user was able to define his own office templates without any involvement of a programmer.

    Is something like this possible with ASP.NET? Especially the point 3 seems to be quite difficult.

    Thanks in Advance for your opinion!

    David

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You can use COM interop in .NET no problem. There's also VSTO. I wouldn't recommend making unmanaged COM calls to open instances of office from a web server though, that's begging for problems.

    Is there any way you can go the other way and give them templates that could populate themselves from a common format spit up by your website via either a webservice call or a separate manual process?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Nov 2005
    Posts
    15
    Thank you for your reccomendations!

    BUT:

    Looking into VSTO documentation it seems that every release works only with certain Office version. So this would be no solution as I cannot force the users to use a specific Office version.

    I am also not able to provide generic templates. The system is at the moment quite versatile so it can generate faxes or letters just by replacement of the Tags.

    One option would be to use XSLT transformation for the table generation but there is probably nothing like this for Word. Another drawback is creation of XSLT template by inexperienced user.

    So the only thing that remains is probably unmanaged com. But that also means that Office has to be installed on the Server, doesn’t it?

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Yes it does. It also means that you're opening instances of office components in-memory on your web server. This is very, very bad for scalability/stability.

    Are you working with any kind of budget? One way to get this done is with Excel services for Sharepoint. However this route is prohibitively expensive for most non-enterprise scenarios.

    If this is for an in-house need, another option would be to forgo ASP.NET in general and go down the winforms/WPF route. This would be MUCH less disconcerting if you opt to go the COM route. You do run in to the issue of making sure you've packaged and deployed dll's and that whole ball of wax, but I'd rather deal with that headache then running office automation in a multi user web environment.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Nov 2005
    Posts
    15
    After doing some search on internet it seems that the solution of my problem is Open XML file format for Office and Open XML SDK for Net. Open XML file format is supported for Office since 2000 so this is probably the best way.

    Thanks for your suggestions anyway!

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Awesome, that's a good nugget to keep in mind for my own dealings!
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •