Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 在Excel中创建带有图像的库_Vb.net_Excel_Gallery_Ribbon - Fatal编程技术网

Vb.net 在Excel中创建带有图像的库

Vb.net 在Excel中创建带有图像的库,vb.net,excel,gallery,ribbon,Vb.net,Excel,Gallery,Ribbon,我试图让smth像这样: 现在我使用imageMso属性只是为了测试。尽管如此,什么也没发生 这是图库的XML: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> <ribbon> <tabs> <tab idMso="TabAddIns" label="Gallery">

我试图让smth像这样:

现在我使用
imageMso
属性只是为了测试。尽管如此,什么也没发生

这是图库的XML:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns" label="Gallery">
        <group id="grpGallery" label="Example Gallery">
          <gallery id="galleryID" label="My Gallery" columns="3" rows="2" size="large"
                   itemHeight="100" itemWidth="100"
                   getItemID="CallbackGetItemID"
                   getItemCount="CallbackGetItemsCount"
                   getItemImage="CallbackGetItemImage"
                   getItemScreentip="CallbackGetItemScreentip"
                   getItemSupertip="CallbackGetItemSupertip">
            <item id="galImg1" imageMso="PictureBrightnessGallery"/>
            <item id="galImg2" imageMso="ZoomPrintPreviewExcel"/>
          </gallery>

....
正如你所见,这没什么特别的。我刚刚进入vb.net+excel的世界。结果是,我在excel选项卡中获得了下拉列表的“我的图库”按钮,但它是空的。没有元素。甚至连虚拟项目都没有

有什么建议吗


注意,我随后尝试在回调中返回实际值。例如,我在回调中看到不存在的ID

如果显式指定了项,则无需为gallery控件添加CallbackGetItemsCount回调

您可以在MSDN中的以下系列文章中阅读有关Ribbon UI的更多信息:


您所说的实际值和不存在的ID是什么意思?我递增ID并为每个元素返回它。回调中是否有指定ID的项?
    Public idCounter As Integer

    Public Sub New()
        idCounter = 0
    End Sub

    Public Function GetCustomUI(ByVal ribbonID As String) As String Implements Office.IRibbonExtensibility.GetCustomUI
        Return GetResourceText("GalleryTest.Gallery.xml")
    End Function

#Region "Ribbon Callbacks"
    Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
        Me.galleryRibbon = ribbonUI
    End Sub

    Public Sub CallbackGetItemID(control As Microsoft.Office.Core.IRibbonControl, _
                                 index As Integer, ByRef itemID As Integer)
        itemID = idCounter
        idCounter += 1
    End Sub

    Public Sub CallbackGetItemsCount(control As Microsoft.Office.Core.IRibbonControl, _
                                        ByRef count As Integer)
        count = 6
    End Sub

    Public Sub CallbackGetItemScreentip(control As Microsoft.Office.Core.IRibbonControl, _
                                        Index As Integer, ByRef screentip As String)
        screentip = "Screentip"
    End Sub

    Public Sub CallbackGetItemSupertip(control As Microsoft.Office.Core.IRibbonControl, _
                                       Index As Integer, ByRef supertip As String)
        'TO DO'
    End Sub