qt QAxObject word文档添加页码(页眉和页脚)

今天偶然一个朋友问起QAxObject 操作word文档添加页码的问题,因为利用QAxObject 做过ppt转pdf的经过,所以花了时间做了一下这个。算是第一次写博客,写的不明白,请大家轻喷,谢谢。
QString QAxBase::generateDocumentation()
Returns a rich text string with documentation for the wrapped COM object. Dump the string to an HTML-file, or use it in e.g. aQTextBrowser widget.
generateDocumentation可以打印出来不同的接口的相应的属性,槽函数,以及信号函数。在generateDocumentation打印出来的html文件,不想assistant有很详细的说明,所以我们可以同时借助VBAWD10.CHM。

下面就是pagenumber的一些相关信息,虽然不是C++语言,但是语言都是相同的大概的意思应该可以看明白。根据下列的提示信息可以有相应的步骤去设置pagenumbers
这里写图片描述

QString filepath = QFileDialog::getOpenFileName(this, tr("Save orbit"), ".", tr("Microsoft Office 2007 (*.docx)"));//获取保存路径  
if (!filepath.isEmpty())
{
QVariantList params;
QAxWidget *excel = new QAxWidget(this);
excel->setControl("Word.Application");//连接Excel控件  
QAxObject *document = excel->querySubObject("Documents");
connect(excel, SIGNAL(exception(int, QString, QString, QString)), this, SLOT(someSlot(int, QString, QString, QString)));
QString text = document->generateDocumentation();
QFile file("test.html");
if (!file.open(QIODevice::WriteOnly 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值