Last post Mar 26, 2009 08:19 AM by samuelmpmac
Mar 25, 2009 04:01 PM|samuelmpmac|LINK
I need to write a web application that will read Microsoft Word documents stored on the server. Those documents will have some tags on them, and some will be substituted by values on tables in the database, and those wich are not associated with values
on the database will be presented in a web form for the user to enter values for them.
I did a lot of research on the internet and it seems that the only way to deal with word documents is through COM ( you use Microsoft.Office.Interop.Word, then you record macros in Word and kind of translate them to c# using those classes). I Even wrote
a class using this method and tested using Windows Forms. Everything seems to be working fine, but when i use it with ASP.Net it doesn't work ok, it doesn't copy from server clipboard (i used System.Windows.Forms.IDataObject data = Clipboard.GetDataObject();).
Besides that, there are a lot of issues about this approach, i'd like to know if anyone ever dealed with similar stuff... First: There is no direct way to retrieve data from the document, wright? You have to use server clipboard. Even if it was working,
in a multi user environment it would cause a lot of trouble... Second: Using Windows Forms i could notice that whenever i open a document, it gets blocked. If i try to open it while it's being used by another instance of the program it shows a window to confirm
if i want to open a read-only version of it, and the method gets waiting...
Please, i really need help with those stuff, any help is welcome.
Mar 25, 2009 05:01 PM|bcanonica|LINK
Try something like this.
Mar 26, 2009 08:19 AM|samuelmpmac|LINK
bcanonica, that's exactly what i told that i had already done...
Now, i found a way to read from the server clipboard in ASP.net if anyone is interested, you have to use another thread, check out this article:
Also, another hint: if you'll make something like replacing tags, you should use "replace all" for replacing each tag, otherwise some tags won't be replaced, don't know why...
But what about the other problems, anyone? Has no one worked with Word in ASP.net before?