Qt调用word 例子
Qt调用word 例子
Getting Microsoft Word Object to SaveAs
- #include <QtGui>
- #include <QAxObject>
- #include <QAxWidget>
- int main(int argc, char **argv)
- {
- QApplication a(argc, argv);
- QAxWidget word("Word.Application");
- word.setProperty("Visible", true);
- QAxObject * documents = word.querySubObject("Documents");
- documents->dynamicCall("Add (void)");
- QAxObject * document = word.querySubObject("ActiveDocument");
- document->dynamicCall("SaveAs (const QString&)", QString("e:/test/docbyqt.doc"));
- document->dynamicCall("Close (boolean)", false);
- word.dynamicCall("Quit (void)");
- return 0;
- }
Getting Microsoft Word Object to SaveAs
- //Start Word
- my_app = new QAxObject("Word.Application", this);
- QAxObject* my_docs = my_app->querySubObject("Documents");
- //Open newDocName
- QVariant filename(newDocName);
- QVariant confirmconversions(false);
- QVariant readonly(false);
- QVariant addtorecentfiles(false);
- QVariant passworddocument("");
- QVariant passwordtemplate("");
- QVariant revert(false);
- QAxObject* doc = my_docs->querySubObject("Open(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", filename,confirmconversions, readonly, addtorecentfiles, passworddocument, passwordtemplate, revert);
- //Pull out active document object
- QAxObject* active_doc = my_app->querySubObject("ActiveDocument");
- QVariant newFileName(fileNameString);
- QVariant fileFormat(10); //Saving as filtered html
- QVariant LockComments(false);
- QVariant Password("");
- QVariant recent(true);
- QVariant writePassword("");
- QVariant ReadOnlyRecommended(false);
- active_doc->querySubObject("SaveAs(const QVariant&, const QVariant&,const QVariant&, const QVariant&, const QVariant&, const QVariant&,const QVariant&)", newFileName, fileFormat, LockComments, Password, recent, writePassword, ReadOnlyRecommended);
Qt调用word 例子的更多相关文章
- 安卓环境下,通过QT调用jar包
在安卓上,许多第三方工具都提供jar包.qt可以通过jni来调用jar包.本文通过一个例子,说明安卓上QT调用jar的方式. 工具/原料 qt android jar包 jar包准备 1 ja ...
- 通过QT查找Word中的关键字,并做高亮或删除操作
最近由于项目需要,要用QT操作Word文档.具体的工作需求:在指定的Word文档(*.doc文件/*.docx文件)中查找关键字,找到后做高亮操作或者直接删除操作,然后另存为到别的目录(表示这个文件被 ...
- QT 调用VS2015编写的Dll
最近在用QT调用VC生成的库,QT使用的是MinGW调试器,出现与动态库不兼容的问题,最后发现QT只能识别VC生成的C格式下的动态库 也就是在导入导出设置时加入extern "C" ...
- Qt调用Server SQL中的存储过程
Server SQL中的存储过程如下: CREATE procedure PINSERTPC @pcnum int, @pcname varchar(50), @pctype int, @ipaddr ...
- Qt调用WebService
从网上查找Qt调用WebService的方案,需要下载三方的类库,而且需要使用好几个控制台命令,才能生成代理客户端类.因为只是简单的测试,没有采用这种方式,直接使用HTTP的Get获取网站内容,也非常 ...
- 服务器端调用Word组件读取Word权限、未将对象引用到对象实例终极解决方案
最近因为业务需要,需要在服务器上调用Word组件,结果遇到各种问题,比如检索 COM 类工厂中 CLSID 为 {000209FF-0000-0000-C000-000000000046} 的组件失败 ...
- c# 异步调用简单例子(转载)
首先来看一个简单的例子: 小明在烧水,等水烧开以后,将开水灌入热水瓶,然后开始整理家务 小文在烧水,在烧水的过程中整理家务,等水烧开以后,放下手中的家务活,将开水灌入热水瓶,然后继续整理家务 这也是日 ...
- Qt打开外部程序和文件夹需要注意的细节(Qt调用VC写的动态库,VC需要用C的方式输出函数,否则MinGW32编译过程会报错)
下午写程序中遇到几个小细节,需要在这里记录一下. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 QProcess *process = new QProcess(this ...
- Qt 向word中插入文字(使用QAxWidget和QAxObject)
pro 文件中要加入 CONFIG += qaxcontainer 2. main.cpp #include <QApplication> #include <QAxWidget&g ...
随机推荐
- GoldentGate Oracle to Oracle 初始化具体解释
一.安装GoldenGate[源端,目标端] 1.创建ogg文件夹 [root@source ~]# mkdir /DBSoft/ogg [root@source ~]# cd /DBSoft/ogg ...
- 将 Shiro 作为一个许可为基础的应用程序 五:password加密/解密Spring应用
考虑系统password的安全,眼下大多数系统都不会把password以明文的形式存放到数据库中. 一把会採取下面几种方式对password进行处理 password的存储 "编码" ...
- 创建采购订单批到程序用的BAPI
CALL FUNCTION 'BAPI_PO_CREATE1' EXPORTING poheader = poheader poheaderx = poheaderx * POADDRVENDOR = ...
- 国际化之DateFormat、NumberFormat
之所以在国际化中介绍DateFormat和NumberFormat这两个类,一是因为本身这两个类是地区敏感类,即可用传入Locale对象:二是因为这两个类具有不同的输出模式,而这些模式能在国际化的动态 ...
- 积累的VC编程小技巧之编辑框
1.如何让对话框中的编辑框接收对话框的消息 ////////////////////////////////////////////////// 如何让对话框中的CEdit控件类接收对话框的消息/// ...
- 在VC下显示JPEG、GIF格式图像的一种简便方法
在VC下显示JPEG.GIF格式图像的一种简便方法 一. 引言 JPEG图像压缩标准随然是一种有损图像压缩标准,但由于人眼视觉的不敏感,经压缩后的画质基本没有发生变化,很快便以较高的压缩率得到了广泛 ...
- 关于iptables的u32匹配
前面一篇文章----阐释了iptables最新的bpf match,说它将多个matches并成了一个经过编译的解释型bytecode bpf match,早在bpf match之前,u32 matc ...
- HW Video Acceleration in Chrome/Chromium HTML5 video 视频播放硬件加速
Introduction Video decode (e.g. YouTube playback) and encode (e.g. video chat applications) are some ...
- Zxing中文乱码解决方法
Zxing中文乱码解决方法总结 尝试过非常多方法 最后发现此方法解决的乱码最多....... 在百度搜索二维码图片 经过前2页的測试 除开一张图之外 其余都能扫描出结果 假设大家有更好的解决方法 ...
- form表单标签的enctype属性的作用
Enctype是指定将数据回发到server时浏览器使用的编码类型.其编码类型有下面三种 一. application/x-www-form-urlencoded 这是通过表单发送数据 ...