介绍
以office word文档为例,在文件→信息→属性→高级属性→自定义 可以对文档属性进行操作
QT实现
首先qt添加ActiveQtC模块
//Word.Application表示操作word文档
QAxObject* document = new QAxObject("Word.Application");
//true表示前台会打开word程序,false表示后台打开
document->dynamicCall("SetVisible(bool)", true);
// 打开文档
QAxObject* documents = document->querySubObject("Documents");
QAxObject* doc = documents->querySubObject("Open(const QString&)", "E:/code/document.docx");
// 获取全部自定义属性
QAxObject* customProps = doc->querySubObject("CustomDocumentProperties");
//添加名为test的属性
QAxObject* customProp = customProps->querySubObject("Add(const QString&, bool, int, const QVariant&)", "test", false, 1, QVariant(111));
//