Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Office Word
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?
Posted 6-Dec-11 0:14am

1 solution

Rate this: bad
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.
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.
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 512
1 Maciej Los 445
2 Sergey Alexandrovich Kryukov 421
3 CPallini 200
4 _Asif_ 135
0 Sergey Alexandrovich Kryukov 6,813
1 OriginalGriff 5,342
2 Peter Leow 3,837
3 Mika Wendelius 2,850
4 CHill60 2,748

Advertise | Privacy | Mobile
Web01 | 2.8.150224.1 | Last Updated 6 Dec 2011
Copyright © CodeProject, 1999-2015
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