Word doesn't create document

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5kcmVhcyBIZW5nc3RlYmVjaw==?=, Jul 23, 2007.

  1. Hi,

    I'm using a Word Interop (Word 2007) in C# to open a document, make some
    text replacement, save it temporary and then send it to the user. I'm doing
    this like this:

    ....
    app = new word.Application();
    doc = app.Documents.Add(ref templateFile, ref falseValue, ref missing, ref
    missing);
    ....

    On local environment and on my testserver (Windows 2003 - I know "MS doesn't
    support server-side office automation") it works fine. But after deployed to
    my ISP doc = null and app.Documents.Count = 0. Why?
    Can anybody help me?

    Thanks a lot,
    Andreas Hengstebeck
    =?Utf-8?B?QW5kcmVhcyBIZW5nc3RlYmVjaw==?=, Jul 23, 2007
    #1
    1. Advertising

  2. I would very very seriously consider a Word Document component instead of
    Word itself - there are plenty around (I think), and you will have this
    working one day, and it crashing the next, for no apparent reason.

    However, if you want to follow this path of madness, have you checked that
    the ISP has installed Word on the Web Server? It won't be there as standard.

    It also could be a permissions issue of the user on the web server not
    having sufficient permissions to run Word (maybe?)

    "Andreas Hengstebeck" wrote:

    > Hi,
    >
    > I'm using a Word Interop (Word 2007) in C# to open a document, make some
    > text replacement, save it temporary and then send it to the user. I'm doing
    > this like this:
    >
    > ...
    > app = new word.Application();
    > doc = app.Documents.Add(ref templateFile, ref falseValue, ref missing, ref
    > missing);
    > ...
    >
    > On local environment and on my testserver (Windows 2003 - I know "MS doesn't
    > support server-side office automation") it works fine. But after deployed to
    > my ISP doc = null and app.Documents.Count = 0. Why?
    > Can anybody help me?
    >
    > Thanks a lot,
    > Andreas Hengstebeck
    =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?=, Jul 23, 2007
    #2
    1. Advertising

  3. Hi,

    Word is installed, the same version as on the test system. The web is
    running impersonated by another user, which can run the word application. And
    also the path is correct. I forget to write it on the first post.

    Another idea?
    And which Word Document component do you mean?

    Andi

    "" wrote:

    > I would very very seriously consider a Word Document component instead of
    > Word itself - there are plenty around (I think), and you will have this
    > working one day, and it crashing the next, for no apparent reason.
    >
    > However, if you want to follow this path of madness, have you checked that
    > the ISP has installed Word on the Web Server? It won't be there as standard.
    >
    > It also could be a permissions issue of the user on the web server not
    > having sufficient permissions to run Word (maybe?)
    >
    > "Andreas Hengstebeck" wrote:
    >
    > > Hi,
    > >
    > > I'm using a Word Interop (Word 2007) in C# to open a document, make some
    > > text replacement, save it temporary and then send it to the user. I'm doing
    > > this like this:
    > >
    > > ...
    > > app = new word.Application();
    > > doc = app.Documents.Add(ref templateFile, ref falseValue, ref missing, ref
    > > missing);
    > > ...
    > >
    > > On local environment and on my testserver (Windows 2003 - I know "MS doesn't
    > > support server-side office automation") it works fine. But after deployed to
    > > my ISP doc = null and app.Documents.Count = 0. Why?
    > > Can anybody help me?
    > >
    > > Thanks a lot,
    > > Andreas Hengstebeck
    =?Utf-8?B?QW5kcmVhcyBIZW5nc3RlYmVjaw==?=, Jul 23, 2007
    #3
  4. Software Artisans have an Office Writer component suitable for ASP.NET which
    will create Word and Excel documents on the server, and you can send them to
    the client. This is much more robust and less expensive on the server than
    running Word. http://officewriter.softartisans.com/officewriter-8.aspx

    I think that there are some more as well.

    "Andreas Hengstebeck" wrote:

    > Hi,
    >
    > Word is installed, the same version as on the test system. The web is
    > running impersonated by another user, which can run the word application. And
    > also the path is correct. I forget to write it on the first post.
    >
    > Another idea?
    > And which Word Document component do you mean?
    >
    > Andi
    >
    > "" wrote:
    >
    > > I would very very seriously consider a Word Document component instead of
    > > Word itself - there are plenty around (I think), and you will have this
    > > working one day, and it crashing the next, for no apparent reason.
    > >
    > > However, if you want to follow this path of madness, have you checked that
    > > the ISP has installed Word on the Web Server? It won't be there as standard.
    > >
    > > It also could be a permissions issue of the user on the web server not
    > > having sufficient permissions to run Word (maybe?)
    > >
    > > "Andreas Hengstebeck" wrote:
    > >
    > > > Hi,
    > > >
    > > > I'm using a Word Interop (Word 2007) in C# to open a document, make some
    > > > text replacement, save it temporary and then send it to the user. I'm doing
    > > > this like this:
    > > >
    > > > ...
    > > > app = new word.Application();
    > > > doc = app.Documents.Add(ref templateFile, ref falseValue, ref missing, ref
    > > > missing);
    > > > ...
    > > >
    > > > On local environment and on my testserver (Windows 2003 - I know "MS doesn't
    > > > support server-side office automation") it works fine. But after deployed to
    > > > my ISP doc = null and app.Documents.Count = 0. Why?
    > > > Can anybody help me?
    > > >
    > > > Thanks a lot,
    > > > Andreas Hengstebeck
    =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?=, Jul 23, 2007
    #4
  5. "Andreas Hengstebeck" <> wrote
    in message news:...

    > I know "MS doesn't support server-side office automation"


    That's right - because it doesn't work.

    > it works fine.


    No it doesn't. You only *think* it works because you're not actually doing
    server-side automation when everything is running on the same machine...

    > But after deployed to my ISP doc = null and app.Documents.Count = 0. Why?


    Because it doesn't work.

    > Can anybody help me?


    Yep - don't do it.

    Use this instead: http://www.aspose.com/Products/Aspose.Words/Default.aspx


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Jul 23, 2007
    #5
  6. "Mark Rae [MVP]" wrote:

    > "Andreas Hengstebeck" <> wrote
    > in message news:...
    >
    > > I know "MS doesn't support server-side office automation"

    >
    > That's right - because it doesn't work.
    >
    > > it works fine.

    >
    > No it doesn't. You only *think* it works because you're not actually doing
    > server-side automation when everything is running on the same machine...


    IT IS WORKING ON THE TESTSERVER!!!!!!!!!!

    >
    > > But after deployed to my ISP doc = null and app.Documents.Count = 0. Why?

    >
    > Because it doesn't work.
    >
    > > Can anybody help me?

    >
    > Yep - don't do it.


    I have to.

    >
    > Use this instead: http://www.aspose.com/Products/Aspose.Words/Default.aspx
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
    =?Utf-8?B?QW5kcmVhcyBIZW5nc3RlYmVjaw==?=, Jul 23, 2007
    #6
  7. "Andreas Hengstebeck" <> wrote
    in message news:...

    >> Yep - don't do it.

    >
    > I have to.


    No you don't. You absolutely and positively do *not* need to use server-side
    Office automation to create Word documents...

    Why on earth do you think that you do...?


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Jul 23, 2007
    #7
  8. * Mark Rae [MVP] wrote, On 23-7-2007 20:27:
    > "Andreas Hengstebeck" <>
    > wrote in message news:...
    >
    >>> Yep - don't do it.

    >>
    >> I have to.

    >
    > No you don't. You absolutely and positively do *not* need to use
    > server-side Office automation to create Word documents...
    >
    > Why on earth do you think that you do...?


    Probably some business requirements dude ;)

    I second Aspose, though I've had my share of problems with them as well.
    But that was two years ago, they probably fixed loads of bugs since then.

    You could also do Word XML and merge the contents with the document
    using XSL. I've seen some people do magic with that. Though it's not my
    point of expertise.

    Jesse
    Jesse Houwing, Jul 23, 2007
    #8
  9. "Jesse Houwing" <> wrote in message
    news:...

    >> Why on earth do you think that you do...?

    >
    > Probably some business requirements dude ;)


    I have to disagree with you there... The business requirements no doubt say
    "you will produce Word documents from the website" - they most certainly
    don't say "you will use server-side Office automation and nothing but
    server-side Office automation to produce Word documents from the website".
    If they do, then the business analyst should be shot - after being sued...

    > I second Aspose, though I've had my share of problems with them as well.
    > But that was two years ago, they probably fixed loads of bugs since then.


    Never had a problem with it...

    > You could also do Word XML and merge the contents with the document using
    > XSL. I've seen some people do magic with that. Though it's not my point of
    > expertise.


    WordXML is not for the faint-hearted but, if you can master it, it's
    extremely powerful...

    Of course, you could just generate an HTML document and give it a .doc
    extension - Word won't care, and the users won't even notice the
    difference... :)


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Jul 23, 2007
    #9
  10. "Of course, you could just generate an HTML document and give it a .doc
    extension - Word won't care, and the users won't even notice the
    difference... :)"

    The problem with this is that 9 times out of 10, when you've got to create a
    Word document on a server it has to be based on an existing Word template.
    You need a proper component to load the template and add your data to it.

    "Mark Rae [MVP]" wrote:

    > "Jesse Houwing" <> wrote in message
    > news:...
    >
    > >> Why on earth do you think that you do...?

    > >
    > > Probably some business requirements dude ;)

    >
    > I have to disagree with you there... The business requirements no doubt say
    > "you will produce Word documents from the website" - they most certainly
    > don't say "you will use server-side Office automation and nothing but
    > server-side Office automation to produce Word documents from the website".
    > If they do, then the business analyst should be shot - after being sued...
    >
    > > I second Aspose, though I've had my share of problems with them as well.
    > > But that was two years ago, they probably fixed loads of bugs since then.

    >
    > Never had a problem with it...
    >
    > > You could also do Word XML and merge the contents with the document using
    > > XSL. I've seen some people do magic with that. Though it's not my point of
    > > expertise.

    >
    > WordXML is not for the faint-hearted but, if you can master it, it's
    > extremely powerful...
    >
    > Of course, you could just generate an HTML document and give it a .doc
    > extension - Word won't care, and the users won't even notice the
    > difference... :)
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
    =?Utf-8?B?cml2YWxAbmV3c2dyb3Vwcy5ub3NwYW0=?=, Jul 23, 2007
    #10
  11. "" <>
    wrote in message news:...

    > "Of course, you could just generate an HTML document and give it a .doc
    > extension - Word won't care, and the users won't even notice the
    > difference... :)"
    >
    > The problem with this is that 9 times out of 10, when you've got to create
    > a
    > Word document on a server it has to be based on an existing Word template.
    > You need a proper component to load the template and add your data to it.


    So use Aspose - it's just made for this sort of functionality...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Jul 23, 2007
    #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. Ravikanth[MVP]
    Replies:
    0
    Views:
    377
    Ravikanth[MVP]
    Aug 7, 2003
  2. Sharon
    Replies:
    0
    Views:
    591
    Sharon
    Jul 27, 2005
  3. srk
    Replies:
    0
    Views:
    622
  4. srk
    Replies:
    0
    Views:
    595
  5. Michael G. Schneider

    Modifying a Word document without using Word Automation

    Michael G. Schneider, Dec 15, 2003, in forum: ASP General
    Replies:
    5
    Views:
    271
    el.c. - myLittleTools.net
    Dec 16, 2003
Loading...

Share This Page