Show TOC

string RibbonGetContent(IRibbonControl ribbonControl); Locate this document in the navigation structure

Creates dynamic buttons, whose content changes depending on the context.

You create dynamic buttons in very specific cases.

If you do not want to create any dynamic buttons, enter return string.Empty;.

Example
 public string RibbonGetContent(IRibbonControl ribbonControl)
		{
 			XmlDocument xmlDoc = new System.Xml.XmlDocument();
 			XmlElement menuElement = xmlDoc.CreateElement("menu");
				menuElement.SetAttribute("xmlns", "http://schemas.microsoft.com/office/2006/01/customuiInformation published on non-SAP site");
 			xmlDoc.AppendChild(menuElement);

 			XmlElement customTest = xmlDoc.CreateElement("menuSeparator");
				customTest.SetAttribute("id", "CustomSeparatorRA1");
				customTest.SetAttribute("title", "Dynamic Report List");
				menuElement.AppendChild(customTest);

 //Here is create a fake list... just to have a list.
 //Replace by the list of element that you want to display
				EPMExcelSheet epmExcelSheet = newEPMExcelSheet(ExcelApplication.ActiveSheet as_Worksheet);
				EPMReportManager reportManager = EPMExcelReportManagerRepository.GetReportManager(epmExcelSheet);
 			List<string> reportList = reportManager.GetReportList();

 			List<KeyValuePair<string, string>> listCustom = newList<KeyValuePair<string, string>>();
 			foreach (string report in reportList)
 			{
 					listCustom.Add(newKeyValuePair<string, string>(report, reportManager.GetReportName(report)));
 			}
 			foreach (KeyValuePair<string, string> keyValue in listCustom)
 			{

 // A Button for each element in the list
				XmlElement element = xmlDoc.CreateElement("button");
 			element.SetAttribute("id", string.Format("Report{0}",keyValue.Key));
				element.SetAttribute("tag", keyValue.Key);
 			element.SetAttribute("label", keyValue.Value);

 //each element must call RibbonOnActionForDynamicExtension as callBack
	//then the method RibbonOnAction will be called each time the user clicks on the button
				element.SetAttribute("onAction", "RibbonOnActionForDynamicExtension");
				menuElement.AppendChild(element);
				}
				return xmlDoc.OuterXml;
				}