Click here to Skip to main content
11,931,584 members (62,963 online)
Rate this:
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 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 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 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 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 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.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