views:

175

answers:

3

Update2: For now, I'm considering saving a temporary copy of the document in html format to display it, but this kills my idea to show the user's real time affect on the document. It's just bad practice to re-save at every character input and reload the browser. So, I suppose this may just be impractical for now. I'll keep my ear to this thread for any answers that might arise. Thank you for your help.

Update1: The WebBrowser works for PDF, but not Word Documents for some reason. Instead of displaying in the browser control, it opens the document in word. This is apparently something having to do with file to program association within the operating system, but I'm programming this to work on machines besides my own. Therefore, I'll either need a work around, or a way to change the setting programmatically.

Interestingly, when I right click on a doc file, click Open With, and select Internet Explorer, it opens Word.

Original Question:

I'm writing a VB program that fills in values within a word document. I'm utilizing the Microsoft Word 12.0 Object Library as a Reference.

I'd like to provide a scrollable preview pane to my user that is within the form he or she is using. It would be even cooler if the user could edit the document through this pane.

I've done Interop extensively, so I'm well aware of how to write and edit a Word document. I just want to put it into a frame and preview it. I'll probably try to select around the document based on what is changing as the user provides input so they can see what's being changed and where. Thoughts?

Thanks

+2  A: 

Would the print preview not do this?

Ardman
I'm imagining a dynamic preview that jumps to different points that are being edited. If I can get the preview going within a frame or something, I imagine that I'll be able to select around the document to display the edited text.
Tychumsempir
+1  A: 

Edit: Removed previous answer since it's not recommended by MS.

This article talks about using the WebBrowser control to open OFfice documents instead

http://support.microsoft.com/kb/304643/

ho1
I am researching that now.
Tychumsempir
Might not be a good option, I just saw this question: http://stackoverflow.com/questions/1439168/ms-kb311765-and-dsoframer-are-missing-from-ms-site
ho1
Okay, cool. I'm redirecting my research. Luckily I didn't waste much time on DSOFramer--I went to lunch instead.
Tychumsempir
Okay, well, this was an interesting exercise, but for some strange reason, it opens the documents in Word instead of in the browser window. I can view PDF files via the browser...but not docs...
Tychumsempir
A: 

Okay, I'm answering my own question, but leveling up those that tried to answer. I've decided that the best solution is to actually open the word document, but keep my form's TopMost property set to True. Then, I can doc my form in the upper right, display the document being edited behind it, and select around to each point being manipulated. This effectively accomplishes what I was after.

Thank you to those that provided answers here. They led me to learn quite a bit of stuff.

Tychumsempir