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 20:52:50 浏览: 127
出现这个错误的原因是在当前选中的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` 是一个枚举值,需要在代码中正确地定义。
* Exception is: org.gradle.execution.TaskSelectionException: Task 'compileDebug' is ambiguous in root project 'HBuilder-Integrate-AS'. Candidates are: 'compileDebugAidl', 'compileDebugAndroidTestAidl' , 'compileDebugAndroidTestJavaWithJavac', 'compileDebugAndroidTestRenderscript', 'compileDebugAndroidTestShaders', 'compileDebugAndroidTestSources', 'compileDebugJavaWithJavac', 'compileDebugRenderscript', 'compileDebugShaders', 'compileDebugSources', 'compileDebugUnitTestJavaWithJavac', 'compileDebugUnitTestSources'.
This error message usually occurs when there are multiple tasks with similar names and Gradle is unable to determine which one to execute.
To resolve this issue, you can specify the full task name that you want to execute. For example, if you want to execute the 'compileDebug' task, you can specify it as follows:
```
./gradlew app:compileDebug
```
This command will execute the 'compileDebug' task for the 'app' module. You can replace 'app' with the name of your module.
If this doesn't resolve the issue, try cleaning and rebuilding your project using the following commands:
```
./gradlew clean
./gradlew build
```
I hope this helps! Let me know if you have any other questions.
阅读全文