gpt4 book ai didi

c++ - 使用 Qt 在 MS Word 中添加新页面

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:02:11 36 4
gpt4 key购买 nike

我正在使用 Qt 4.5 并使用 ActiveQt 生成 MS Word 文档。我能够基于 VBA for MS Word 的 ActiveX 命令创建文档。但是我无法在所需位置创建新页面。

我试过了

selection->dynamicCall("InsertBreak(const QString &)","wdPageBreak");
selection->dynamicCall("InsertParagraph(void)");
QAxObject *partTableParagraph = activeDocument->querySubObject("Paragraphs(1)");
partTableParagraph->setProperty("PageBreakBefore","True");
QAxObject *partTableRange = partTableParagraph->querySubObject("Range");
selection->dynamicCall("TypeText(const QString&)","second page contents");

但我仍然无法在word文档中创建新页面。第二页的内容也不可见。即 second page contents 不可见。

欢迎就此提出任何建议。

最佳答案

我建议您先将其编写为 VBA 宏。一旦你让它在 VBA 中运行,你应该能够将它直接转换为 ActiveQt。

关于c++ - 使用 Qt 在 MS Word 中添加新页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3229043/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com