Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Word doesn't create document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andreas Hengstebeck - 23 Jul 2007 14:52 GMT
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
rival@newsgroups.nospam - 23 Jul 2007 15:14 GMT
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?)

> Hi,
>
[quoted text clipped - 15 lines]
> Thanks a lot,
> Andreas Hengstebeck
Andreas Hengstebeck - 23 Jul 2007 15:20 GMT
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

> 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
[quoted text clipped - 25 lines]
> > Thanks a lot,
> > Andreas Hengstebeck
rival@newsgroups.nospam - 23 Jul 2007 15:44 GMT
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.

> Hi,
>
[quoted text clipped - 36 lines]
> > > Thanks a lot,
> > > Andreas Hengstebeck
Mark Rae [MVP] - 23 Jul 2007 17:55 GMT
> 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

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Andreas Hengstebeck - 23 Jul 2007 19:12 GMT
> > I know "MS doesn't support server-side office automation"
>
[quoted text clipped - 4 lines]
> 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?
>
[quoted text clipped - 3 lines]
>
> Yep - don't do it.

I have to.

> Use this instead: http://www.aspose.com/Products/Aspose.Words/Default.aspx
Mark Rae [MVP] - 23 Jul 2007 19:27 GMT
>> 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...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Jesse Houwing - 23 Jul 2007 20:32 GMT
* Mark Rae [MVP] wrote, On 23-7-2007 20:27:

>>> Yep - don't do it.
>>
[quoted text clipped - 4 lines]
>
> 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
Mark Rae [MVP] - 23 Jul 2007 21:31 GMT
>> 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... :-)

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

rival@newsgroups.nospam - 23 Jul 2007 22:54 GMT
"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.

> >> Why on earth do you think that you do...?
> >
[quoted text clipped - 21 lines]
> extension - Word won't care, and the users won't even notice the
> difference... :-)
Mark Rae [MVP] - 23 Jul 2007 23:02 GMT
> "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
[quoted text clipped - 4 lines]
> 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...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.