How to add working button and label to Excel sheet

Hello, first of all, great work on the library, it works like a charm.

I am porting code that used to be com excel interop and using Aspose instead and everything was pretty straightforward to port except the buttons and labels of the sheet.

I am able to create the button or label with aspose with Aspose, but once I open the sheet, when I click on the button or label, it selects it instead of actually clicking on it.

Here is how I create the controls :

Label btnAddRequest = worksheet.Shapes.AddLabel(rowIndex, 10, 1, 5, 12, 50);
btnAddRequest.Name = “btnAddRequestGroup” + groupIndex.ToString();
btnAddRequest.Text = “Add”;
btnAddRequest.Placement = PlacementType.Move;

or
Button btnAddRequest = worksheet.Shapes.AddButton(rowIndex, 10, 1, 5, 12, 50);
btnAddRequest.Name = “btnAddRequestGroup” + groupIndex.ToString();
btnAddRequest.Text = “Add”;
btnAddRequest.Placement = PlacementType.MoveAndSize;

Before, with Excel interop, here’s how I created my label :

Excel.Shape btnAddRequest = worksheet.Shapes.AddOLEObject(“Forms.Label.1”, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 5, 47 + 14.25 * (rowIndex - 4), 20, 12.75);

btnAddRequest.Name = “btnAddRequestGroup” + groupIndex.ToString();
Excel.OLEObject sheetBtn = (Excel.OLEObject)worksheet.OLEObjects(btnAddRequest.Name);
sheetBtn.Object.GetType().InvokeMember(“Caption”, BindingFlags.SetProperty, null, sheetBtn.Object, new object[] { “Add” });
sheetBtn.Object.GetType().InvokeMember(“BackStyle”, BindingFlags.SetProperty, null, sheetBtn.Object, new object[] { 0 });
sheetBtn.Object.GetType().InvokeMember(“ForeColor”, BindingFlags.SetProperty, null, sheetBtn.Object, new object[] { 16711680 });
sheetBtn.Object.GetType().InvokeMember(“FontBold”, BindingFlags.SetProperty, null, sheetBtn.Object, new object[] { true });
sheetBtn.Object.GetType().InvokeMember(“FontSize”, BindingFlags.SetProperty, null, sheetBtn.Object, new object[] { 9 });

Any ideas?
Thanks

Hi,

Could you post the created file with Excel interop? We will check it soon.

We find if the button of the Forms toolbar is assigned Macro, clicking will effect.