问题描述
我有三个相关的问题.
我想用 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!