Class ComboBox

Class ComboBox

Namespace: Aspose.Cells.Drawing
Assembly: Aspose.Cells.dll (25.2.0)

Represents the control form ComboBox.

public class ComboBox : Shape

Inheritance

objectShapeComboBox

Inherited Members

Shape.GetResultOfSmartArt(), Shape.ToFrontOrBack(int), Shape.GetLockedProperty(ShapeLockType), Shape.SetLockedProperty(ShapeLockType, bool), Shape.AddHyperlink(string), Shape.RemoveHyperlink(), Shape.MoveToRange(int, int, int, int), Shape.AlignTopRightCorner(int, int), Shape.GetConnectionPoints(), Shape.ToImage(Stream, ImageType), Shape.ToImage(string, ImageOrPrintOptions), Shape.ToImage(Stream, ImageOrPrintOptions), Shape.GetLinkedCell(bool, bool), Shape.SetLinkedCell(string, bool, bool), Shape.GetInputRange(bool, bool), Shape.SetInputRange(string, bool, bool), Shape.UpdateSelectedValue(), Shape.CalculateTextSize(), Shape.FormatCharacters(int, int, Font, StyleFlag), Shape.Characters(int, int), Shape.GetRichFormattings(), Shape.RemoveActiveXControl(), Shape.IsSameSetting(object), Shape.GetActualBox(), Shape.MacroName, Shape.IsEquation, Shape.IsSmartArt, Shape.ZOrderPosition, Shape.Name, Shape.AlternativeText, Shape.Title, Shape.Line, Shape.Fill, Shape.ShadowEffect, Shape.Reflection, Shape.Glow, Shape.SoftEdges, Shape.ThreeDFormat, Shape.FormatPicture, Shape.IsHidden, Shape.IsAspectRatioLocked, Shape.RotationAngle, Shape.Hyperlink, Shape.Id, Shape.Spid, Shape.Spt, Shape.Worksheet, Shape.IsGroup, Shape.IsInGroup, Shape.IsWordArt, Shape.TextEffect, Shape.IsLocked, Shape.IsPrintable, Shape.MsoDrawingType, Shape.AutoShapeType, Shape.AnchorType, Shape.Placement, Shape.UpperLeftRow, Shape.UpperDeltaY, Shape.UpperLeftColumn, Shape.UpperDeltaX, Shape.LowerRightRow, Shape.LowerDeltaY, Shape.LowerRightColumn, Shape.LowerDeltaX, Shape.Right, Shape.Bottom, Shape.Width, Shape.WidthInch, Shape.WidthPt, Shape.WidthCM, Shape.Height, Shape.HeightInch, Shape.HeightPt, Shape.HeightCM, Shape.Left, Shape.LeftInch, Shape.LeftCM, Shape.Top, Shape.TopInch, Shape.TopCM, Shape.TopToCorner, Shape.LeftToCorner, Shape.X, Shape.Y, Shape.WidthScale, Shape.HeightScale, Shape.TopInShape, Shape.LeftInShape, Shape.WidthInShape, Shape.HeightInShape, Shape.Group, Shape.Type, Shape.HasLine, Shape.IsFilled, Shape.IsFlippedHorizontally, Shape.IsFlippedVertically, Shape.ActualLowerRightRow, Shape.RelativeToOriginalPictureSize, Shape.LinkedCell, Shape.InputRange, Shape.TextShapeType, Shape.TextBody, Shape.Font, Shape.TextOptions, Shape.Text, Shape.IsRichText, Shape.HtmlText, Shape.TextVerticalOverflow, Shape.TextHorizontalOverflow, Shape.IsTextWrapped, Shape.TextOrientationType, Shape.TextHorizontalAlignment, Shape.TextVerticalAlignment, Shape.TextDirection, Shape.TextBoxOptions, Shape.ControlData, Shape.ActiveXControl, Shape.Paths, Shape.Geometry, Shape.CreateId, Shape.IsDecorative, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[C#]

//Create a new Workbook.        
Workbook workbook = new Workbook();

//Get the first worksheet.
Worksheet sheet = workbook.Worksheets[0];

//Get the worksheet cells collection.
Cells cells = sheet.Cells;

//Input a value.
cells["B3"].PutValue("Employee:");

//Set it bold.
Style style = cells["B3"].GetStyle();
style.Font.IsBold = true;
cells["B3"].SetStyle(style);

//Input some values that denote the input range
//for the combo box.
cells["A2"].PutValue("Emp001");
cells["A3"].PutValue("Emp002");
cells["A4"].PutValue("Emp003");
cells["A5"].PutValue("Emp004");
cells["A6"].PutValue("Emp005");
cells["A7"].PutValue("Emp006");

//Add a new combo box.
Aspose.Cells.Drawing.ComboBox comboBox = sheet.Shapes.AddComboBox(2, 0, 2, 0, 22, 100);

//Set the linked cell;
comboBox.LinkedCell = "A1";

//Set the input range.
comboBox.InputRange = "A2:A7";

//Set no. of list lines displayed in the combo 
//box's list portion.
comboBox.DropDownLines = 5;

//Set the combo box with 3-D shading.
comboBox.Shadow = true;

//AutoFit Columns
sheet.AutoFitColumns();

//Saves the file.
workbook.Save(@"tstcombobox.xls");

'Create a new Workbook.
Dim workbook As Workbook = New Workbook()

'Get the first worksheet.
Dim sheet As Worksheet = workbook.Worksheets(0)

'Get the worksheet cells collection.
Dim cells As Cells = sheet.Cells

'Input a value.
cells("B3").PutValue("Employee:")

'Set it bold.
Dim style As Style = cells("B3").GetStyle()
style.Font.IsBold = true
cells("B3").SetStyle(style)

'Input some values that denote the input range
'for the combo box.
cells("A2").PutValue("Emp001")
cells("A3").PutValue("Emp002")
cells("A4").PutValue("Emp003")
cells("A5").PutValue("Emp004")
cells("A6").PutValue("Emp005")
cells("A7").PutValue("Emp006")

'Add a new combo box.
Dim comboBox As Aspose.Cells.Drawing.ComboBox = sheet.Shapes.AddComboBox(2, 0, 2, 0, 22, 100)

'Set the linked cell;
comboBox.LinkedCell = "A1"

'Set the input range.
comboBox.InputRange = "A2:A7"

'Set no. of list lines displayed in the combo
'box's list portion.
comboBox.DropDownLines = 5

'Set the combo box with 3-D shading.
comboBox.Shadow = True

'AutoFit Columns
sheet.AutoFitColumns()

'Saves the file.
workbook.Save("tstcombobox.xls")

Properties

DropDownLines

Gets or sets the number of list lines displayed in the drop-down portion of a combo box.

public int DropDownLines { get; set; }

Property Value

int

SelectedCell

Gets the selected cell in the input range of the combo box.

public Cell SelectedCell { get; }

Property Value

Cell

SelectedIndex

Gets or sets the index number of the currently selected item in a list box or combo box. Zero-based.

public int SelectedIndex { get; set; }

Property Value

int

Remarks

-1 presents no item is selected.

SelectedValue

Gets the selected value of the combox box.

public string SelectedValue { get; }

Property Value

string

Shadow

Indicates whether the combobox has 3-D shading.

public bool Shadow { get; set; }

Property Value

bool