Word doesn't create document

G

Guest

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
 
G

Guest

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?)
 
G

Guest

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
 
M

Mark Rae [MVP]

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
 
G

Guest

Mark Rae said:
That's right - because it doesn't work.


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!!!!!!!!!!
Because it doesn't work.


Yep - don't do it.

I have to.
 
M

Mark Rae [MVP]

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...?
 
J

Jesse Houwing

* Mark Rae [MVP] wrote, On 23-7-2007 20:27:
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
 
M

Mark Rae [MVP]

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... :)
 
G

Guest

"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.
 
M

Mark Rae [MVP]

"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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top