QAxBase::dynamicCallHelper: ActiveWindow.Selection: No such property in [Microsoft Word 97 - 2003 Document] Candidates are: ActiveTheme ActiveThemeDisplayName ActiveWindow Application AttachedTemplate AutoFormatOverride AutoHyphenation AutoSaveOn
时间: 2024-03-01 15:52:50 浏览: 23
出现这个错误的原因是在当前选中的Word文档中,不存在名为"ActiveWindow.Selection"的属性。您需要检查一下代码中的文档对象是否正确获取,以及是否有打开并选中了文档。
如果您已经打开了文档并选中了内容,可以尝试使用以下代码来获取当前选中内容:
```
QAxObject* selection = document->querySubObject("Selection");
```
然后再根据需要进行操作。如果仍然无法解决问题,请提供更多的代码和错误信息以便我更好地帮助您。
相关问题
QAxBase::dynamicCallHelper: ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary): No such property in {000209ff-0000-0000-c000-000000000046} [Microsoft Word Application] Candidates are: ActiveDocument ActiveEncryptionSession ActivePrinter ActiveProtectedViewWindow ActiveWindow AddIns AnswerWizard Application ArbitraryXMLSupportAvailable Assistance Assistant AutoCaptions AutoCorrect AutoCorrectEmail AutomationSecurity
这个错误信息提示 `ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)` 这个属性不存在于 Word COM 对象中。可能是因为您使用的 Word 版本与代码中使用的不同,或者代码中使用的属性名称不正确。
为了解决这个问题,您可以尝试使用以下代码来获取页眉对象,并将页码居中对齐:
```
QAxObject *header = m_wordWidget->querySubObject("ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)");
QAxObject *range = header->querySubObject("Range");
QAxObject *pageNumbers = range->querySubObject("PageNumbers");
pageNumbers->dynamicCall("Add(wdPageNumberStyleArabic)"); // 添加页码
QAxObject *pageNumbersRange = pageNumbers->querySubObject("Range");
pageNumbersRange->dynamicCall("ParagraphFormat.Alignment = wdAlignParagraphCenter"); // 设置页码居中对齐
```
这段代码中,我们直接使用 `ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)` 获得页眉对象,并且在页码范围内设置居中对齐属性。请注意,这里的 `wdAlignParagraphCenter` 是一个枚举值,需要在代码中正确地定义。
Task 'biuld' not found in root project 'IPTVFramework'. Some candidates are: 'build'.
这个错误提示是因为您在执行构建任务时,命令中的单词拼写错误了。正确的拼写应该是 "build",而不是 "biuld"。因此,您可以尝试使用正确的命令来执行构建任务,例如:
```
./gradlew build
```
如果您在使用不同的构建工具或脚本,请确认您的命令中是否存在拼写错误,并将其改正。