Hi
Hi,
Thanks for the reply. Unfortunatly I am not able to get it to work like i want. I am using this code for the
Aspose.Cells.Drawing.ListBox YesNolistBox = shet.Shapes.AddListBox(y - 1, 0, 18, 0, 28, 100);
YesNolistBox.InputRange = “sheet1!A1:A2”;
// YesNolistBox.DropDownLines = 2;
YesNolistBox.Shadow = true;
YesNolistBox.Placement = Aspose.Cells.Drawing.PlacementType.FreeFloating;
Aspose.Cells.Drawing.ListBox ActioncomboBox = shet.Shapes.AddListBox(y - 1, 0, 16, 0, 28, 120);
ActioncomboBox.InputRange = “sheet1!A4:A8”;
// ActioncomboBox.DropDownLines = 6;
ActioncomboBox.Shadow = true;
ActioncomboBox.Placement = Aspose.Cells.Drawing.PlacementType.FreeFloating;
But the boxes look like the attached image. I’d really appreciate to be able to control the layout of the controls in the sheet.
br
Hans Jørgen
Hi Hans Jørgen,
Hi Barbar
Thanks for the reply. Maybe this picture shows more clearly the problem I have. If the row is where i place the control is low the contols adjust according to this. I would like to have all controls exactly same size and then have the row height adjusted to the controls. is that possible to do in code?
Hi Hans Jørgen,
Workbook workbook = new Workbook();
// Get the first worksheet
Worksheet worksheet1 = workbook.Worksheets[0];
// Fill different cells with data in the range
worksheet1.Cells[0, 0].PutValue(“Blue”);
worksheet1.Cells[1, 0].PutValue(“Red”);
worksheet1.Cells[2, 0].PutValue(“Green”);
worksheet1.Cells[3, 0].PutValue(“Yellow”);
int rowNum = 10;
// Add a new combo box
Aspose.Cells.Drawing.ComboBox box = worksheet1.Shapes.AddComboBox(rowNum, 0, 18, 0, 28, 100);
box.InputRange = “sheet1!A1:A4”;
box.Shadow = true;
box.Placement = Aspose.Cells.Drawing.PlacementType.FreeFloating;
rowNum = 20;
Aspose.Cells.Drawing.ListBox listBox = worksheet1.Shapes.AddListBox(rowNum, 0, 18, 0, 128, 100);
listBox.Placement = PlacementType.FreeFloating;
listBox.LinkedCell = “B1”;
listBox.InputRange = “sheet1!A1:A4”;
listBox.Shadow = true;
worksheet1.Cells.Rows[rowNum].Height = listBox.HeightPt;
// Save the Excel file.
workbook.Save(dir + “output.xlsx”);
My problem is that the boxes do resize with the row height in some cases. I am in a bit of a hurry so I will make the user input options i an different way for now and will take the central elements from my code and put here when I have my head i bit above water again.
Thanks for trying to help me out
Hi Hans Jørgen,