从 C++ 创建、打开和打印 word 文件 [英] Creating, opening and printing a word file from C++

查看:31
本文介绍了从 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++ 实现办公自动化的常见问题解答/196776http://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++:

这些示例中的大部分都展示了如何使用 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆