Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating Word Document on the Server

Status
Not open for further replies.

craigber

Programmer
May 5, 2003
1,092
0
0
US
I need to generate a Word document on an application server. I can think of a couple of ways to do this:

1. Require each customer to purchase and install Word on the server. Issues: Does the Word license allow this? What happens if multiple users attempt this at the same time?

2. Purchase a third party library that will create the document. Issues: Do third party libraries written in C# exist for this? If so, I need to look at licensing costs.

Has anyone done this before? Recommendations? Note that using something like Crystal Reports and saving as a Word document will not work because we allow the customer to create their own Word templates that are used in the application.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
For the love of Bob, DON'T use server-side word automation. I don't think that the license allows it (at least not with a single license - not sure about the setup you describe), but it causes major headaches down the road.

Something like this might be useful for you:
There are also RTF libraries out there that you could use.

If you can avoid doing word automation on the server, you will really thank yourself for it later on.

Hope this helps,

Alex

[small]----signature below----[/small]
The author of the monograph, a native of Schenectady, New York, was said by some to have had the highest I.Q. of all the war criminals who were made to face a death by hanging. So it goes.

My Crummy Web Page
 
Requirement is for server-side automation, if possible. Thanks for the link, I'll look into it.

An additional problem could be running on a 64-bit server. Gotta look into that.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
Requirement is for server-side automation, if possible.
I'm with Alex on this. automating office on a server is not the intention of a web application. If they want MS Office automation, why not build a desktop application?

why not export to RTF and let the end user use Word to view the output?

what ever your solution, find a 3rd party library to do this. Most reporting solutions allow you to export to a variety of file formats. the best place to ask about licensing is the 3rd party vendor.

you could write the Word document using MS xml Word Document schema. I have seen this done for XLS with CarlosArgs' XML XLS writer. This would require learning the xml schema (I don't know where to find it, msdn? technet?)

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
This is a desktop application, but all the processing and logic is happening on the server. My instructions are to make it happen on the server, if possible. I must use Word and we allow the the customer to create their own templates, then the application does a merge to get the data into the document. I can't use MS xml Word document schema because we have to support versions prior to Word 2007.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
I believe the xml option is supported with Word 2003. It is for Excel 2003. that's how I dump data to excel in web applications.

now it could be that the schema's are different, but that would be a problem either way.

What your client requires makes sense, to some degree. I think a better forum to ask this questions would be an MS Office forum. Or contact MS directly and ask for some help.

I'm still at a loss as to why the client "requires" the merge happen on the server instead of locally. the client's machine requires MS Word to create the template. The server would push data to the client. the client would merge the data with their template.

if this happens on the server the client must push the template to the server, then tell the server to use the template and the load the data. this will eventually get sent back to the client is some form or another.

this just seems like more work. Not to mention the licensing issues. I can only imagine that a M$ server/processor license for Office/Word (if it exists) is very salty. Basically the client will require 1 license per user for the local machine and a CPU license for the server. If the server is a multi-proc box, which most are, then it's licenses x CPUs.

Final thought. merging data in MS Word is a presentation layer concern, it's for human consumption. the server doesn't care about presentation. it gets the data and passes it to clients. I would press more on why the client requires the Merge to occur on the server.

You also mention multiple times "if possible". explain to your customer, that it is not feasibly possible and explain the counterpoints. Then explain the benefits of pushing this working onto the clients locally.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I think you may confuse what the actual requirement is and what the design requirement may be that your company has set up (using word on the server).

Microsoft tells you to never use office on a server. It was not made for that. They point out that it can lead to memory leakage and other issues. I'll try to find the article. Basically, what i'm trying to say, is that if Microsoft doesn't want you to do it, they probably know of some design flaws in their own code that could cause some damage to your server or make your app not work very well.

I would follow what the others have suggested and use an open format that Word can open. That is, if this is truly a design issue. Otherwise, you need to rethink the design of the app and figure out if it would be better to exist on the client and store on the server.
 
Memory leakage? Huh? That makes absolutely no sense. Windows Server and workstations are essentially the same, built on the same code base. If you have references to statements that say you're right about that, then I'll look at them.

I didn't say we absolutely have to run on the server. That's my requirement, but it can change due to technical or licensing issues.

As for using a different format, that is absolutely not an option. The new application will be replacing an existing one and we can't require customers to convert all their Word templates to something else.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
Thanks, David. Memory leaks are one thing, but that article confirms other issues I had concerns about when running Word on the server. I just needed documentation for backup to get to the boss.

My next step is to look for third party tools that can run on the server. If that doesn't work, then we'll have to do it on the workstation.



Craig Berntson
MCSD, Visual FoxPro MVP,
 
Good luck in your search. Let us know what you end up using to resolve this.
 
There's at least a half-dozen libraries out there for creation of Word-2003 compatible documents. I don't know how many are certified for use on a server (or licensed that way!) but if you were to have a look at a website like ComponentSource or CDW, you might could get some ideas.

Chip H.



____________________________________________________________________
www.chipholland.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top