如何使用MFC读取MS Word文档?

发布于 2024-09-10 21:37:50 字数 185 浏览 2 评论 0原文

我正在使用 VC++/MFC 进行一个项目,我需要从 Word 文档中读取数据。我用谷歌搜索过,但找不到任何可行的解决方案。我怎样才能开始使用这个MFC?任何帮助将不胜感激!

更新:我在 MS 支持网站和 Google 上可以找到的信息确实已经过时了,我需要在 Word 2003 或 2007 上使用。

I'm working on a project using VC++/MFC and I need to read data from Word documents. I've Googled, but can't find any viable solutions. How can I get started in this MFC? Any help would be appreciated!

UPDATE: Information I can find on the MS support site and Google is really out-of-date, and I need work with on Word 2003 or 2007.

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

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

发布评论

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

评论(3

睫毛上残留的泪 2024-09-17 21:37:50

您可以使用 OLE 自动化直接与 ms word 对话: http://support.microsoft.com/kb/ 196776

虽然这可能不是一个可行的解决方案,因为必须安装 word。

You can use OLE automation to talk directly to ms word: http://support.microsoft.com/kb/196776

Though this may not be a viable solution because word must be installed.

假扮的天使 2024-09-17 21:37:50

这里的一个挑战是读取格式化信息、读取表内的测试等。如果是纯流读取,那就简单得多。

我在我的一个项目中所做的就是定义书签并读取书签中的数据。这样我就不必担心文档中的布局。但是,要使其发挥作用,您在准备 Word 文档时应牢记这一点。没有任何通用的Word文档可以这样阅读。

就我而言,这是一份申请表,所以我的任务很简单,因为我是提供Word文档供用户填写数据的人。

One challenge here is to read the formatting information, read test inside a Table etc.. If it were plain stream reading, it would have been much simpler.

What I did in one of my projects was to define bookmarks and read the data in the bookmark. That way I didn't have to worry about the layout in the document. However, for this to work, your word document should be prepared keeping this in mind. Not any generic word document can be read like this.

In my case it was an application form, so my task was simple as I was the one providing the word document for users to fill in data.

小忆控 2024-09-17 21:37:50

您可能需要考虑使用 用于 VC++/MFC 的 Word 自动化类,它基于 Microsoft Excel 自动化类(Excel 97 开发人员工具包中 AutoXL 的端口)。它应该适用于所有版本的 MS Word(包括 2003/2007)。

You may want to consider using the Word Automation Class for VC++/MFC, which is based on the Microsoft Excel Automation Class (a port of AutoXL in the Excel 97 Developer's Kit). It should work for all versions of MS Word (2003/2007 included).

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