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 文件


基础教程推荐
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01