Automating Word Document creation from ASP.NET

Discussion in 'ASP .Net' started by mc, Nov 6, 2006.

  1. mc

    mc Guest

    I've know that Microsoft don't currently recommend this process, what
    I'm trying to find out is why?

    This is a feature that I've used (with Classic ASP) in the past with a
    great deal of success.

    Regards


    MC
    mc, Nov 6, 2006
    #1
    1. Advertising

  2. Because of the licensing issues. It shouldn't make any difference what
    server-side platform you are using.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    "mc" <> wrote in message
    news:454f5c38$...
    > I've know that Microsoft don't currently recommend this process, what I'm
    > trying to find out is why?
    >
    > This is a feature that I've used (with Classic ASP) in the past with a
    > great deal of success.
    >
    > Regards
    >
    >
    > MC
    Eliyahu Goldin, Nov 6, 2006
    #2
    1. Advertising

  3. mc

    Mark Rae Guest

    "mc" <> wrote in message
    news:454f5c38$...

    > I've know that Microsoft don't currently recommend this process, what I'm
    > trying to find out is why?


    http://www.aspose.com/wiki/default.aspx/Aspose.Total/WhyNotAutomation.html

    > This is a feature that I've used (with Classic ASP) in the past with a
    > great deal of success.


    Then you've either been very lucky, or your site has had a tiny number of
    concurrent connections trying to instantiate Word...
    Mark Rae, Nov 6, 2006
    #3
  4. because word is not designed for this. you will run into scaling and memory
    usage issues.

    -- bruce (sqlwork.com)


    "mc" <> wrote in message
    news:454f5c38$...
    > I've know that Microsoft don't currently recommend this process, what I'm
    > trying to find out is why?
    >
    > This is a feature that I've used (with Classic ASP) in the past with a
    > great deal of success.
    >
    > Regards
    >
    >
    > MC
    bruce barker \(sqlwork.com\), Nov 6, 2006
    #4
  5. mc

    mc Guest

    Mark Rae wrote:
    > "mc" <> wrote in message
    > news:454f5c38$...
    >
    >
    >>I've know that Microsoft don't currently recommend this process, what I'm
    >>trying to find out is why?

    >
    >
    > http://www.aspose.com/wiki/default.aspx/Aspose.Total/WhyNotAutomation.html
    >
    >
    >>This is a feature that I've used (with Classic ASP) in the past with a
    >>great deal of success.

    >
    >
    > Then you've either been very lucky, or your site has had a tiny number of
    > concurrent connections trying to instantiate Word...
    >
    >


    On our current system word is invoked 25-50 times a day, so I'd guess
    our success is mainly due to that!
    mc, Nov 6, 2006
    #5
  6. mc

    Mark Rae Guest

    "bruce barker (sqlwork.com)" <> wrote
    in message news:...

    > because word is not designed for this. you will run into scaling and
    > memory usage issues.


    Quite so, although the OP implies that he has an absolutely tiny hit-rate
    (less than 50 a day), so he probably hasn't encountered many problems so
    far...
    Mark Rae, Nov 6, 2006
    #6
  7. mc

    Mark Rae Guest

    "mc" <> wrote in message
    news:454f65e6$...

    > On our current system word is invoked 25-50 times a day, so I'd guess our
    > success is mainly due to that!


    I guess so!

    On another note, I'm assuming you know that you don't actually *need* Word
    at all to create valid Word documents... You don't even need a 3rd-party
    utility like Aspose. All you need is the ability to generate XML in the form
    that Word understands. Unless your Word documents are *very* complex and/or
    *very* large, this can be achieved quite simply and efficiently. If you take
    one of your existing Word documents, open it in Word, click Save As and
    choose the XML format, you can then open the XML document and see how it's
    structured.

    Assuming all your users have fairly recent versions of Word (the last two, I
    think), if you take such an XML document and give it a .doc extension, Word
    will open it directly without any problems...

    You can use the same technique for other Office apps e.g. Excel, PowerPoint
    etc.
    Mark Rae, Nov 6, 2006
    #7
  8. Server side COM automation with Office is not recommended or supported by
    Microsoft. Here is their official statement on the subject:
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

    Here are some tips and suggestions for working with Word (and Excel) the
    right way:
    http://SteveOrr.net/articles/ExcelExport.aspx
    http://SteveOrr.net/articles/ExportPanel.aspx
    http://SteveOrr.net/reviews/AsposeWord.aspx
    http://SteveOrr.net/reviews/OfficeWriter.aspx
    http://msdn.microsoft.com/office/understanding/vsto/

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "mc" <> wrote in message
    news:454f5c38$...
    > I've know that Microsoft don't currently recommend this process, what I'm
    > trying to find out is why?
    >
    > This is a feature that I've used (with Classic ASP) in the past with a
    > great deal of success.
    >
    > Regards
    >
    >
    > MC
    Steve C. Orr [MVP, MCSD], Nov 6, 2006
    #8
  9. mc

    mc Guest

    Mark Rae wrote:
    > "mc" <> wrote in message
    > news:454f65e6$...
    >
    >
    >>On our current system word is invoked 25-50 times a day, so I'd guess our
    >>success is mainly due to that!

    >
    >
    > I guess so!
    >
    > On another note, I'm assuming you know that you don't actually *need* Word
    > at all to create valid Word documents... You don't even need a 3rd-party
    > utility like Aspose. All you need is the ability to generate XML in the form
    > that Word understands. Unless your Word documents are *very* complex and/or
    > *very* large, this can be achieved quite simply and efficiently. If you take
    > one of your existing Word documents, open it in Word, click Save As and
    > choose the XML format, you can then open the XML document and see how it's
    > structured.
    >
    > Assuming all your users have fairly recent versions of Word (the last two, I
    > think), if you take such an XML document and give it a .doc extension, Word
    > will open it directly without any problems...
    >
    > You can use the same technique for other Office apps e.g. Excel, PowerPoint
    > etc.
    >
    >


    Unfortunately I currently use the word automation to create a
    complicated document, during the automation I dynamically create tables,
    I will however look into this as I like the XML template Idea!

    Thanks


    MC
    mc, Nov 8, 2006
    #9
  10. mc

    Mark Rae Guest

    "mc" <> wrote in message
    news:4551be36$...

    > I will however look into this as I like the XML template Idea!


    In almost all situations, it can be an extremely efficient solution.

    Obviously, ASP.NET and XML are pretty much "made for each other", so you
    almost certainly won't have any problems in actually generating the XML
    itself...

    Assuming you go down this route and get it working, I would strongly suggest
    that you uninstall Word / Office from your webserver, as you will no longer
    need it - also, that will mean you will no longer need to worry about
    whether you need a separate Word licence for every possible visitor, for
    every concurrent visitor only, or just for the server itself... :)
    Mark Rae, Nov 8, 2006
    #10
  11. mc

    Mark Rae Guest

    "rodchar" <> wrote in message
    news:...

    > After saving my document as XML and looking at the source how do i get
    > started and programming against the xml document?


    Same way you would manipulate any other XML document... The XML schemas for
    the Office suite are readily available:
    http://www.google.co.uk/search?sour...s=GGLG,GGLG:2006-28,GGLG:en&q=word xml schema

    > if i wanted to take a customer in Northwind and their orders and display
    > it
    > in word is this somethng i can do easily with xml tip?


    I suppose that really depends on your definition of "easily"...

    At the end of the day, XML is XML is XML - if you're fairly familiar with
    XML documents and transformations, this will present very little difficulty
    to you. If, on the other hand, you've never used XML before, you'll have a
    bit of a learning curve - same as you would have with any other technology
    new to you...

    On the other hand, if you don't need all of the minute detail that the XML
    format will give you, you can just as easily (probably much more so!) create
    a simple HTML document and give it a .doc extension - that will cause Word
    to open it, whereupon it will recognise it as an HTML document and render it
    accordingly...

    E.g.

    1) Open Notepad

    2) Paste the HTML below:

    <html>
    <body>
    Hello
    </body>
    <html>

    3) Save it as C:\Test.doc

    4) Close Notepad

    5) Double-click C:\Test.doc
    Mark Rae, Dec 8, 2006
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Domino

    Automating Word

    Domino, Dec 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    419
    Domino
    Dec 8, 2003
  2. Mills
    Replies:
    0
    Views:
    4,589
    Mills
    Jun 14, 2004
  3. Smithers

    Automating Image/Button Creation

    Smithers, May 16, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,545
    Steve C. Orr [MVP, MCSD]
    May 16, 2005
  4. =?iso-8859-1?q?Premshree=20Pillai?=

    Automating the Creation of Python Executables

    =?iso-8859-1?q?Premshree=20Pillai?=, Jan 13, 2004, in forum: Python
    Replies:
    0
    Views:
    289
    =?iso-8859-1?q?Premshree=20Pillai?=
    Jan 13, 2004
  5. Brendan
    Replies:
    0
    Views:
    260
    Brendan
    Jun 9, 2009
Loading...

Share This Page