In one VSTO project for MS WORD
, I created a custom Office Ribbon - with a button - for WORD 2010-2016
using VS2017 - Update 1809
as follows. Question: How can I achieve exactly the same using Open XML SDK 2.5 for Office in a similar VS2017 - Open XML for Office project? I've not found such examples online:
Ribbon in VSTO example:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
<tabs>
<tab idMso="TabAddIns" label="my Ribbon Tab">
<group id="ContentGroup" label="Content">
<button id="textButton" label="Insert Text" screentip="Text" onAction="OnTextButton"
supertip="Inserts text at the cursor location."/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Callback method of the button in the above ribbon:
public void OnTextButton(Office.IRibbonControl control)
{
Word.Range currentRange = Globals.ThisAddIn.Application.Selection.Range;
currentRange.Text = "This text was added by the Ribbon.";
}
UPDATE:
Motivation: I've created a VSTO add-in for MS WORD that creates a custom tab in WORD doc's top ribbon. The tab has multiple controls (buttons, checkboxes, etc.) that perform various actions via their respective callbacks (similar to the example shown in my post above). I want to convert that VSTO add-in to do the same using Open XML SDK for Office because VSTO Add-ins cannot be published to Microsoft Stores
as explained here. And new office Add-in functionality does not support some functionalities that my legacy VSTO add-in does.