Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Office Word
Hello,
I would like to use Word as Reporting tool for a database application. I can export the data to XML and embed it in a .docx file. But now, how do I create an "Edit session" with Word, in which the user can make modifications, print-outs etc. As default the file shall be temporary and discarded when Word is closed. Also, the user shall get a notification/security reminder when he saves the file.
 
Is that possible?
 
Thanks
/J
Posted 6-Dec-11 0:14am
bjarket220

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

One way is to use Interop with Word. Have a look at Microsoft.Office.Interop.Word Namespace[^]. You can create documents, wire events etc.
  Permalink  
Comments
bjarket at 6-Dec-11 5:29am
   
Thanks, no, I haven't. I guess I could get a notification event before the document is saved. Not sure if I can make it modal though, such that the message box appears as part of Word...
 
Ideas about how to open the document as a temporary file would also be much appreciated.
Thanks.
Mika Wendelius at 6-Dec-11 5:32am
   
If you create an instance of the Word, the document is actually memory resident (not saved yet). You can use interop to save it for example into temp folder if you like, but it's not necessary.
bjarket at 6-Dec-11 5:58am
   
That sounds great. However, could you please explain what is meant by creating an instance of the Word - you mean opening the .docx file with Word, or?
Mika Wendelius at 6-Dec-11 6:27am
   
There are lots of articles showing how you can control Word application via interop. Here's one example: Summarize C# Control Word Skills[^]
bjarket at 6-Dec-11 6:30am
   
Yes, thanks for the interop advice. I can see that I need to get started reading ;-) Thanks /J
Mika Wendelius at 6-Dec-11 6:36am
   
You're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 197
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 6 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100