我想在表单上预览 Word 文档

发布于 2024-08-30 23:43:04 字数 735 浏览 1 评论 0原文

Update2:目前,我正在考虑以 html 格式保存文档的临时副本来显示它,但这会扼杀我显示用户对文档的实时影响的想法。在每次输入字符时重新保存并重新加载浏览器是一种不好的做法。所以,我想这目前可能不切实际。我会密切关注这个话题,寻找可能出现的任何答案。感谢您的帮助。

Update1:​​WebBrowser 适用于 PDF,但由于某种原因不适用于 Word 文档。它不是在浏览器控件中显示,而是在 Word 中打开文档。这显然与操作系统内的文件与程序关联有关,但我正在对其进行编程以使其在我自己的机器上工作。因此,我要么需要解决方法,要么需要一种以编程方式更改设置的方法。

有趣的是,当我右键单击文档文件,单击打开方式,然后选择 Internet Explorer 时,它会打开 Word。

原问题:

我正在编写一个VB程序来填充 Word 文档中的值。我是 使用 Microsoft Word 12.0 作为参考的对象库。

我想向我的用户提供一个可滚动的预览窗格 他或她正在使用的表格。 如果用户可以的话会更酷 通过此窗格编辑文档。

我广泛地进行了互操作,所以我 非常了解如何编写和编辑 Word 文档。我只是想把它 进入框架并预览它。患病的 可能会尝试选择周围 文档基于正在发生的变化 用户提供输入,以便他们可以 查看正在更改的内容和位置。 想法?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

始终不够爱げ你 2024-09-06 23:43:04

打印预览不会这样做吗?

Would the print preview not do this?

走过海棠暮 2024-09-06 23:43:04

编辑:删除了以前的答案,因为 MS 不推荐它。

本文讨论如何使用 WebBrowser 控件打开 OFfice 文档

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

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/

百思不得你姐 2024-09-06 23:43:04

好吧,我正在回答我自己的问题,但会提升那些试图回答的问题。我决定最好的解决方案是实际打开 Word 文档,但将表单的 TopMost 属性设置为 True。然后,我可以在右上角记录我的表单,在其后面显示正在编辑的文档,然后选择要操作的每个点。这有效地实现了我所追求的目标。

感谢在这里提供答案的人。他们让我学到了很多东西。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文