Word Document with ASP.NET


A

aychai

Hi all,

I have a scenario where users fills in textbox fields on ASP.NET page
from the server and when he/she clicks on a download button, the data
from fields will insert into an existing word template.

The user will then be asked whether to save as or open the word
document on his client machine.

Question1)Is there a way to manipulate the word document in memory
without having to save it onto server's disk?
Currently, I am using the Word class from Microsoft Word 11.0 object
library to open existing word template, insert data into bookmark
location, and save as new document on the server. Then I open the file
and send the file for user to download through Response.WriteFile().
This method works, but it requires a physical document to be created
everytime.

Question2)How do I check the file lock to see if other process is
finished with the file and my application can go ahead and write to it
(in C#)? If there's some sample code for checking that, it will be
great!

Thanks abunch!

Anthony
 
Ad

Advertisements

C

Cowboy \(Gregory A. Beamer\)

1) There are third party libraries to do this (Office Writer is a good shot)
2) Better option is to either a) create the doc in memory from a string (ie,
put the word doc into a string) or b) clone off the in-memory representation
so the file can be released. This is also easier when you DON'T use the
office DLLs.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
Ad

Advertisements


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

Top