【问题标题】:How do I add tooltips to my Custom Excel Ribbon UI?如何将工具提示添加到我的自定义 Excel 功能区 UI?
【发布时间】:2018-07-31 18:31:08
【问题描述】:

This may be a duplicate,但我无法让此功能正常工作。使用该答案中找到的 XML。

如何将自定义工具提示添加到 Excel 功能区?我用的是Custom UI Editor for Microsoft Office,我的代码如下:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
    <tabs>
        <tab id="customTab" label="Quoting Utilities" insertBeforeMso="TabHome">

            <group id="CGImportingFiles" label="Importing Files">
                <button id="ImportOpenWorkbook" label="Import Open Workbook" size="large" imageMso="InfopathExportToExcel" onAction="CGCImportOpenWorkbook" screentip="Title" supertip="Imports the data from an open workbook" />
                <button id="ImportSavedWorkbook" label="Import Saved Workbook" size="large" imageMso="FormExportToExcel" onAction="CGCImportSavedWorkbook" supertip="Imports the data from a saved workbook" />
                <button id="ImportFromClipboard" label="Import From Clipboard" size="large" imageMso="PasteSingleCellTableAsTable" onAction="CGCImportFromClipboard" supertip="Pastes the clipboard contents" />
                <button id="ClearDataTable" label="Clear Data Table" size="large" imageMso="NewTableStyle2" onAction="CGCClearDataTable" supertip="Clears all data within the data table" />
            </group>
            <group id="CGCleaningData" label="Cleaning Data">
                <button id="UnmergeConsolidate" label="Unmerge Selection and Consolidate" size="large" imageMso="CatalogMergeCreateList" onAction="CGCUnmergeConsolidate" supertip="Unmerges all cells within the selection. If doing so would leave any empty rows or columns, delete them" />
                <button id="CropSelection" label="Crop Selection" size="large" imageMso="PageFitToDrawing" onAction="CGCCropSelection" supertip="Deletes all data in the sheet which is outside the current selection. Selection is moved to A1" />
                <button id="RemoveSpecialChars" label="Remove Special Characters" size="large" imageMso="WordCount" onAction="CGCRemoveSpecialChars" supertip="Removes all non-keyboard characters within selection (depends on header datatype)" />
                <button id="RangeAssign" label="Assign Value to Range" size="large" imageMso="EnableInlineEdit" onAction="CGCRangeAssign" supertip="Assign one value to each cell in a range of cells" />
            </group>
            <group id="CGDataCategories" label="Header Functions">
                <button id="ResetColumnHeaders" label="Reset Column Headers" size="large" imageMso="FieldChooser" onAction="CGCResetColumnHeaders" supertip="Clears all header selections" />
                <button id="ClearBlankHeaders" label="Clear Blank Headers" size="large" imageMso="CrossFunctionalFlowchartVerticalDirection" onAction="CGCClearBlankHeaders" supertip="Replaces all blank header selections with actual blanks (a hyphen -> a blank)" />
                <button id="ValidateColumnSelections" label="Validate Column Headers" size="large" imageMso="ReviewRevisionAccept" onAction="CGCValidateColumnSelections" supertip="Check that all required headers exist, that no header is duplicated, that every header has data, and that all data has a header" />
                <button id="SortIntoStandardFormat" label="Sort Columns by Std Order" size="large" imageMso="ArrangeTools" onAction="CGCSortIntoStandardFormat" supertip="Sort data into the standard format, based on headers" />
            </group>
            <group idMso="GroupEnterDataAlignment" />
            <group idMso="GroupEnterDataNumber" />
            <group idMso="GroupClipboard" />
            <group idMso="GroupAlignmentExcel" />
            <group idMso="GroupCells" />                                
            <group idMso="GroupEditingExcel" />
        </tab>
    </tabs>
</ribbon>

请注意,第一个按钮 (ImportOpenWorkbook) 有一个 screentip="Title" 和 supertip="Imports the data from an open workbook" 标签。其余按钮只有 supertip 标签。我也试过 only 包括 screentip 标签,但没有成功。

此功能应该显示菜单项的悬停工具提示,对吗?为什么没有发生这种情况?

我正在使用 Microsoft Office Professional Plus 2013。

下面的屏幕截图:有问题的自定义功能区选项卡。虽然我的屏幕截图程序没有捕获光标,但第一个菜单项当前位于光标下方。即使等待 10 秒,也不会出现这样的工具提示。我还不能成功地显示一个工具提示。

截图如下:选项窗口,显示功能ScreenTips已经启用。注意:也没有其他(内置)函数显示屏幕提示!有人可以告诉我屏幕提示应该是什么样的吗?如果我的客户端设置启用了它们,但没有出现,问题可能是什么原因?

作为参考,自定义 UI 编辑器按钮的 MSDN 文档位于 here

【问题讨论】:

  • 过去,屏幕提示和超级提示都对我有用。使用自定义 UI 编辑器时要记住的一件事(我认为 - 已经有一段时间了,我正在记忆中)是在自定义 UI 编辑器中打开它之前,您需要完全关闭 PPT 中的文件,那么您必须先保存并关闭自定义 UI,然后才能在 PowerPoint 中重新打开它。
  • @DavidZemens 谢谢,但我在整个开发过程中一直遵循这种做法。我也尝试过完全重启,看看是否有任何影响。没有这样的运气。 (稍微修正一下,我用的是Excel)
  • 啊好的。是的,我脑子里有 PPT,因为那是我开发的东西,并且正在查看我的一些旧 XML。虽然在 Excel/Word/PPT 中的想法相同 :) 这是 Screentip + Supertip 的屏幕截图,请原谅“supertipe”中的错字imgur.com/a/HD2MSfR

标签: xml vba excel user-interface


【解决方案1】:

我找到了自己问题的答案!我会分享给后人的。

解决方案

问题中的关键信息是:

也没有其他(内置)函数显示屏幕提示!

我能够找到屏幕提示的第二个设置(为什么有两个不同的设置意味着“显示屏幕提示”,我可能永远不知道)。截图如下:

以前,屏幕提示样式设置是“不显示屏幕提示”,但应该是“在屏幕提示中显示功能描述”。再一次,这个设置感觉对问题中描述的设置是多余的,但根据微软的说法,“功能”和“功能”之间可能存在差异......?如果是这样,这些术语(显然)很容易混淆。

无论如何,屏幕提示(和超级提示)现在都可以正确显示!请看下面的截图:

反驳问题

为什么微软有两个标题如此相似的设置?

如果您知道为什么这是两个不同的设置,也许将其作为评论加入有助于进一步澄清这个问题,或者至少有助于理解术语“功能”和“功能”的含义。

【讨论】:

    猜你喜欢
    • 2014-12-28
    • 2012-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多