Creating, opening and printing a word file from C++(从 C++ 创建、打开和打印 word 文件)
问题描述
我有三个相关的问题.
我想用 C++ 中的名称创建一个 word 文件.我希望能够将打印命令发送到该文件,以便在用户不必打开文档并手动执行该文件的情况下打印该文件,并且我希望能够打开该文档.打开文档应该只是打开 word 然后打开文件.
I want to create a word file with a name from C++. I want to be able to sent the printing command to this file, so that the file is being printed without the user having to open the document and do it manually and I want to be able to open the document. Opening the document should just open word which then opens the file.
推荐答案
您可以使用 Office 自动化来完成此任务.您可以在 http://support.microsoft.com/kb 上找到有关使用 C++ 实现办公自动化的常见问题解答/196776 和 http://support.microsoft.com/kb/238972.
You can use Office Automation for this task. You can find answers to frequently asked questions about Office Automation with C++ at http://support.microsoft.com/kb/196776 and http://support.microsoft.com/kb/238972 .
请记住,要使用 C++ 进行办公自动化,您需要了解如何使用 COM.
Keep in mind that to do Office Automation with C++, you need to understand how to use COM.
以下是如何在 word usign C++ 中执行各种任务的一些示例:
Here are some examples of how to perform various tasks in word usign C++:
- http://support.microsoft.com/kb/220911/en-us
- http://support.microsoft.com/kb/238393/en-us
- http://support.microsoft.com/kb/238611/en-us
这些示例中的大部分都展示了如何使用 MFC 进行操作,但是使用 COM 操作 Word 的概念是相同的,即使您直接使用 ATL 或 COM.
Most of these samples show how to do it using MFC, but the concepts of using COM to manipulate Word are the same, even if you use ATL or COM directly.
这篇关于从 C++ 创建、打开和打印 word 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 C++ 创建、打开和打印 word 文件


- 从python回调到c++的选项 2022-11-16
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 静态初始化顺序失败 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- STL 中有 dereference_iterator 吗? 2022-01-01
- C++ 协变模板 2021-01-01
- 近似搜索的工作原理 2021-01-01