Aspose::Cells::Drawing::ListBox class

ListBox class

Represents a list box object.

class ListBox : public Aspose::Cells::Drawing::Shape

Methods

MethodDescription
AddHyperlink(const U16String& address)Adds a hyperlink to the shape.
AddHyperlink(const char16_t* address)Adds a hyperlink to the shape.
AlignTopRightCorner(int32_t topRow, int32_t rightColumn)Moves the picture to the top-right corner.
CalculateTextSize()Recalculate the text area.
Characters(int32_t startIndex, int32_t length)Returns a Characters object that represents a range of characters within the text.
FormatCharacters(int32_t startIndex, int32_t length, const Aspose::Cells::Font& font, const StyleFlag& flag)Formats some characters with the font setting.
GetActiveXControl()Gets the ActiveX control.
GetActualBox()Get the actual position and size of the shape (after applying rotation, flip, etc.)
GetActualLowerRightRow()Get the actual bottom row.
GetAlternativeText()Returns or sets the descriptive (alternative) text string of the Shape object.
GetAnchorType()Gets and set the type of the shape anchor placeholder.
GetAutoShapeType()Gets and sets the auto shape type.
GetBottom()Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
GetConnectionPoints()Get the connection points.
GetControlData()Gets the data of control.
GetCreateId(UUID& uuid)Gets and sets create id for this shape.
GetFill()Returns a FillFormat object that contains fill formatting properties for the specified shape.
GetFont()Represents the font of shape.
GetFormatPicture()Gets and sets the options of the picture format.
GetGeometry()Gets the geometry.
GetGlow()Represents a GlowEffect object that specifies glow effect for the chart element or shape.
GetGroup()Gets the group shape which contains this shape.
GetHasLine()Gets and sets the line border of the shape is visible.
GetHeight()Represents the height of shape, in unit of pixel.
GetHeightCM()Represents the height of the shape, in unit of centimeters.
GetHeightInch()Represents the height of the shape, in unit of inches.
GetHeightInShape()Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape..
GetHeightPt()Represents the height of the shape, in unit of points.
GetHeightScale()Gets and sets the height scale,in unit of percent of the original picture height. If the shape is not picture ,the HeightScale property only returns 100;.
GetHtmlText()Gets and sets the html string which contains data and some formats in this textbox.
GetHyperlink()Gets the hyperlink of the shape.
GetId()Gets the identifier of this shape.
GetInputRange()Gets or sets the worksheet range used to fill the specified combo box.
GetInputRange(bool isR1C1, bool isLocal)Gets the range used to fill the control.
GetItemCount()Gets the number of items in the list box.
GetLeft()Represents the horizontal offset of shape from its left column, in unit of pixels.
GetLeftCM()Represents the horizontal offset of shape from its left column, in unit of centimeters.
GetLeftInch()Represents the horizontal offset of shape from its left column, in unit of inches.
GetLeftInShape()Represents the horizontal offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape.
GetLeftToCorner()Gets and sets the horizonal offset of shape from worksheet left border.
GetLine()Gets line style.
GetLinkedCell()Gets or sets the worksheet range linked to the control’s value.
GetLinkedCell(bool isR1C1, bool isLocal)Gets the range linked to the control’s value.
GetLockedProperty(ShapeLockType type)Gets the value of locked property.
GetLowerDeltaX()Gets or sets the shape’s horizontal offset from its lower right corner column.
GetLowerDeltaY()Gets or sets the shape’s vertical offset from its lower right corner row.
GetLowerRightColumn()Represents lower right corner column index.
GetLowerRightRow()Represents lower right corner row index.
GetMacroName()Gets and sets the name of macro.
GetMsoDrawingType()Gets drawing type.
GetName()Gets and sets the name of the shape.
GetPageChange()Specifies the amount by which the control’s value is changed when the user clicks on the scrollbar’s page up or page down region.
GetPaths()Gets the paths of a custom geometric shape.
GetPlacement()Represents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet.
GetReflection()Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape.
GetRelativeToOriginalPictureSize()Indicates whether shape is relative to original picture size.
GetResultOfSmartArt()Converting smart art to grouped shapes.
GetRichFormattings()Returns all Characters objects that represents a range of characters within the text .
GetRight()Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
GetRotationAngle()Gets and sets the rotation of the shape.
GetSelectedCells()Gets the selected cells. Returns null if the input range is not set or no item is selected.
GetSelectedIndex()Gets or sets the index number of the currently selected item in a list box or combo box. Zero-based.
GetSelectionType()Gets or sets the selection mode of the specified list box.
GetShadow()Indicates whether the combobox has 3-D shading.
GetShadowEffect()Represents a Drawing.ShadowEffect object that specifies shadow effect for the chart element or shape.
GetSoftEdges()Gets and sets the radius of blur to apply to the edges, in unit of points.
GetSpid()Specifies an optional string identifier that an application can use to identify the particular shape.
GetSpt()Specifies an optional number that an application can use to associate the particular shape with a defined shape type.
GetText()Gets and sets the text of this shape.
GetTextBody()Gets and sets the setting of the shape’s text.
GetTextBoxOptions()Gets the text information in the shape.
GetTextDirection()Gets/Sets the direction of the text flow for this object.
GetTextEffect()Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Applies to Shape objects that represent WordArt.
GetTextHorizontalAlignment()Gets and sets the text horizontal alignment type of the shape.
GetTextHorizontalOverflow()Gets and sets the text horizontal overflow type of the shape which contains text.
GetTextOptions()Represents the text options of the shape.
GetTextOrientationType()Gets and sets the text orientation type of the shape.
GetTextShapeType()Gets and sets the preset text shape type.
GetTextVerticalAlignment()Gets and sets the text vertical alignment type of the shape.
GetTextVerticalOverflow()Gets and sets the text vertical overflow type of the shape which contains text.
GetThreeDFormat()Gets and sets 3d format of the shape.
GetTitle()Specifies the title (caption) of the current shape object.
GetTop()Represents the vertical offset of shape from its top row, in unit of pixels.
GetTopCM()Represents the vertical offset of shape from its top row, in unit of centimeters.
GetTopInch()Represents the vertical offset of shape from its top row, in unit of inches.
GetTopInShape()Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape.
GetTopToCorner()Gets and sets the vertical offset of shape from worksheet top border, in unit of pixels.
GetType()Gets the auto shape type.
GetUpperDeltaX()Gets or sets the shape’s horizontal offset from its upper left corner column.
GetUpperDeltaY()Gets or sets the shape’s vertical offset from its upper left corner row.
GetUpperLeftColumn()Represents upper left corner column index.
GetUpperLeftRow()Represents the top row index.
GetWidth()Represents the width of shape, in unit of pixels.
GetWidthCM()Represents the width of the shape, in unit of centimeters.
GetWidthInch()Represents the width of the shape, in unit of inch.
GetWidthInShape()Represents the width of the shape, in unit of 1/4000 of the parent shape.
GetWidthPt()Represents the width of the shape, in unit of point.
GetWidthScale()Gets and sets the width scale, in unit of percent of the original picture width. If the shape is not picture ,the WidthScale property only returns 100;.
GetWorksheet()Gets the Worksheet object which contains this shape.
GetX()Gets and sets the horizontal offset of shape from worksheet left border,in unit of pixels.
GetY()Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels.
GetZOrderPosition()Returns the position of a shape in the z-order.
IsAspectRatioLocked()True means that aspect ratio of the shape is locked.
IsDecorative()Indicates whether the object is decorative.
IsEquation()Indicates whether the shape only contains an equation.
IsFilled()Indicates whether the fill format is visible.
IsFlippedHorizontally()Gets and sets whether shape is horizontally flipped .
IsFlippedVertically()Gets and sets whether shape is vertically flipped .
IsGroup()Indicates whether this shape is a group shape.
IsHidden()Indicates whether the object is visible.
IsInGroup()Indicates whether the shape is grouped.
IsLockAspectRatio()(Deprecated) True means that aspect ratio of the shape is locked.
IsLocked()True means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected.
IsNull() constChecks whether the implementation object is nullptr.
IsPrintable()Indicates whether the object is printable. If False, this shape will not be printed when printing.
IsRichText()Whether or not the text is rich text.
IsSameSetting(const Aspose::Cells::Object& obj)Returns whether the shape is same.
IsSelected(int32_t itemIndex)Indicates whether the item is selected.
IsSmartArt()Indicates whether the shape is a smart art.
IsTextWrapped()Gets and sets the text wrapped type of the shape which contains text.
IsWordArt()Indicates whether this shape is a word art.
ListBox(ListBox_Impl* impl)Constructs from an implementation object.
ListBox(const ListBox& src)Copy constructor.
ListBox(const Shape& src)Constructs from a parent object.
MoveToRange(int32_t upperLeftRow, int32_t upperLeftColumn, int32_t lowerRightRow, int32_t lowerRightColumn)Moves the shape to a specified range.
explicit operator bool() constoperator bool()
operator=(const ListBox& src)operator=
operator=(const Shape& src)operator=
RemoveActiveXControl()Remove activeX control.
RemoveHyperlink()Removes the hyperlink of the shape.
SelectedItem(int32_t itemIndex, bool isSelected)Sets whether the item is selected.
SetAlternativeText(const U16String& value)Returns or sets the descriptive (alternative) text string of the Shape object.
SetAlternativeText(const char16_t* value)Returns or sets the descriptive (alternative) text string of the Shape object.
SetAnchorType(ShapeAnchorType value)Gets and set the type of the shape anchor placeholder.
SetAutoShapeType(AutoShapeType value)Gets and sets the auto shape type.
SetBottom(int32_t value)Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
SetCreateId(const UUID& value)Gets and sets create id for this shape.
SetFont(const Aspose::Cells::Font& value)Represents the font of shape.
SetHasLine(bool value)Gets and sets the line border of the shape is visible.
SetHeight(int32_t value)Represents the height of shape, in unit of pixel.
SetHeightCM(double value)Represents the height of the shape, in unit of centimeters.
SetHeightInch(double value)Represents the height of the shape, in unit of inches.
SetHeightInShape(int32_t value)Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape..
SetHeightPt(double value)Represents the height of the shape, in unit of points.
SetHeightScale(int32_t value)Gets and sets the height scale,in unit of percent of the original picture height. If the shape is not picture ,the HeightScale property only returns 100;.
SetHtmlText(const U16String& value)Gets and sets the html string which contains data and some formats in this textbox.
SetHtmlText(const char16_t* value)Gets and sets the html string which contains data and some formats in this textbox.
SetInputRange(const U16String& value)Gets or sets the worksheet range used to fill the specified combo box.
SetInputRange(const char16_t* value)Gets or sets the worksheet range used to fill the specified combo box.
SetInputRange(const U16String& formula, bool isR1C1, bool isLocal)Sets the range used to fill the control.
SetInputRange(const char16_t* formula, bool isR1C1, bool isLocal)Sets the range used to fill the control.
SetIsAspectRatioLocked(bool value)True means that aspect ratio of the shape is locked.
SetIsDecorative(bool value)Indicates whether the object is decorative.
SetIsFilled(bool value)Indicates whether the fill format is visible.
SetIsFlippedHorizontally(bool value)Gets and sets whether shape is horizontally flipped .
SetIsFlippedVertically(bool value)Gets and sets whether shape is vertically flipped .
SetIsHidden(bool value)Indicates whether the object is visible.
SetIsLockAspectRatio(bool value)(Deprecated) True means that aspect ratio of the shape is locked.
SetIsLocked(bool value)True means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected.
SetIsPrintable(bool value)Indicates whether the object is printable. If False, this shape will not be printed when printing.
SetIsTextWrapped(bool value)Gets and sets the text wrapped type of the shape which contains text.
SetLeft(int32_t value)Represents the horizontal offset of shape from its left column, in unit of pixels.
SetLeftCM(double value)Represents the horizontal offset of shape from its left column, in unit of centimeters.
SetLeftInch(double value)Represents the horizontal offset of shape from its left column, in unit of inches.
SetLeftInShape(int32_t value)Represents the horizontal offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape.
SetLeftToCorner(int32_t value)Gets and sets the horizonal offset of shape from worksheet left border.
SetLinkedCell(const U16String& value)Gets or sets the worksheet range linked to the control’s value.
SetLinkedCell(const char16_t* value)Gets or sets the worksheet range linked to the control’s value.
SetLinkedCell(const U16String& formula, bool isR1C1, bool isLocal)Sets the range linked to the control’s value.
SetLinkedCell(const char16_t* formula, bool isR1C1, bool isLocal)Sets the range linked to the control’s value.
SetLockedProperty(ShapeLockType type, bool value)Set the locked property.
SetLowerDeltaX(int32_t value)Gets or sets the shape’s horizontal offset from its lower right corner column.
SetLowerDeltaY(int32_t value)Gets or sets the shape’s vertical offset from its lower right corner row.
SetLowerRightColumn(int32_t value)Represents lower right corner column index.
SetLowerRightRow(int32_t value)Represents lower right corner row index.
SetMacroName(const U16String& value)Gets and sets the name of macro.
SetMacroName(const char16_t* value)Gets and sets the name of macro.
SetName(const U16String& value)Gets and sets the name of the shape.
SetName(const char16_t* value)Gets and sets the name of the shape.
SetPageChange(int32_t value)Specifies the amount by which the control’s value is changed when the user clicks on the scrollbar’s page up or page down region.
SetPlacement(PlacementType value)Represents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet.
SetRelativeToOriginalPictureSize(bool value)Indicates whether shape is relative to original picture size.
SetRight(int32_t value)Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
SetRotationAngle(double value)Gets and sets the rotation of the shape.
SetSelectedIndex(int32_t value)Gets or sets the index number of the currently selected item in a list box or combo box. Zero-based.
SetSelectionType(SelectionType value)Gets or sets the selection mode of the specified list box.
SetShadow(bool value)Indicates whether the combobox has 3-D shading.
SetSoftEdges(double value)Gets and sets the radius of blur to apply to the edges, in unit of points.
SetText(const U16String& value)Gets and sets the text of this shape.
SetText(const char16_t* value)Gets and sets the text of this shape.
SetTextDirection(TextDirectionType value)Gets/Sets the direction of the text flow for this object.
SetTextHorizontalAlignment(TextAlignmentType value)Gets and sets the text horizontal alignment type of the shape.
SetTextHorizontalOverflow(TextOverflowType value)Gets and sets the text horizontal overflow type of the shape which contains text.
SetTextOptions(const TextOptions& value)Represents the text options of the shape.
SetTextOrientationType(TextOrientationType value)Gets and sets the text orientation type of the shape.
SetTextShapeType(AutoShapeType value)Gets and sets the preset text shape type.
SetTextVerticalAlignment(TextAlignmentType value)Gets and sets the text vertical alignment type of the shape.
SetTextVerticalOverflow(TextOverflowType value)Gets and sets the text vertical overflow type of the shape which contains text.
SetTitle(const U16String& value)Specifies the title (caption) of the current shape object.
SetTitle(const char16_t* value)Specifies the title (caption) of the current shape object.
SetTop(int32_t value)Represents the vertical offset of shape from its top row, in unit of pixels.
SetTopCM(double value)Represents the vertical offset of shape from its top row, in unit of centimeters.
SetTopInch(double value)Represents the vertical offset of shape from its top row, in unit of inches.
SetTopInShape(int32_t value)Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape.
SetTopToCorner(int32_t value)Gets and sets the vertical offset of shape from worksheet top border, in unit of pixels.
SetUpperDeltaX(int32_t value)Gets or sets the shape’s horizontal offset from its upper left corner column.
SetUpperDeltaY(int32_t value)Gets or sets the shape’s vertical offset from its upper left corner row.
SetUpperLeftColumn(int32_t value)Represents upper left corner column index.
SetUpperLeftRow(int32_t value)Represents the top row index.
SetWidth(int32_t value)Represents the width of shape, in unit of pixels.
SetWidthCM(double value)Represents the width of the shape, in unit of centimeters.
SetWidthInch(double value)Represents the width of the shape, in unit of inch.
SetWidthInShape(int32_t value)Represents the width of the shape, in unit of 1/4000 of the parent shape.
SetWidthPt(double value)Represents the width of the shape, in unit of point.
SetWidthScale(int32_t value)Gets and sets the width scale, in unit of percent of the original picture width. If the shape is not picture ,the WidthScale property only returns 100;.
SetX(int32_t value)Gets and sets the horizontal offset of shape from worksheet left border,in unit of pixels.
SetY(int32_t value)Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels.
SetZOrderPosition(int32_t value)Returns the position of a shape in the z-order.
Shape(Shape_Impl* impl)Constructs from an implementation object.
Shape(const Shape& src)Copy constructor.
ToFrontOrBack(int32_t orders)Brings the shape to the front or sends the shape to back.
ToImage(const Vector <uint8_t>& stream, Aspose::Cells::Drawing::ImageType imageType)Creates the shape image and saves it to a stream in the specified format.
ToImage(const U16String& imageFile, const ImageOrPrintOptions& options)Saves the shape to a file.
ToImage(const char16_t* imageFile, const ImageOrPrintOptions& options)Saves the shape to a file.
ToImage(const ImageOrPrintOptions& options)Saves the shape to a stream.
UpdateSelectedValue()Update the selected value by the value of the linked cell.
~ListBox()Destructor.
~Shape()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Create a new Workbook.
Workbook workbook;

//Get the first worksheet.
Worksheet sheet = workbook.GetWorksheets().Get(0);

//Get the worksheet cells collection.
Cells cells = sheet.GetCells();

//Input a value.
cells.Get(u"B3").PutValue(u"Choose Dept:");

//Set it bold.
Style style = cells.Get(u"B3").GetStyle();
style.GetFont().SetIsBold(true);
cells.Get(u"B3").SetStyle(style);

//Input some values that denote the input range
//for the list box.
cells.Get(u"A2").PutValue(u"Sales");
cells.Get(u"A3").PutValue(u"Finance");
cells.Get(u"A4").PutValue(u"MIS");
cells.Get(u"A5").PutValue(u"R&amp;D");
cells.Get(u"A6").PutValue(u"Marketing");
cells.Get(u"A7").PutValue(u"HRA");

//Add a new list box.
ListBox listBox = sheet.GetShapes().AddListBox(2, 0, 3, 0, 122, 100);

//Set the placement type.
listBox.SetPlacement(PlacementType::FreeFloating);

//Set the linked cell.
listBox.SetLinkedCell(u"A1");

//Set the input range.
listBox.SetInputRange(u"A2:A7");

//Set the selection style.
listBox.SetSelectionType(SelectionType::Single);

//Set the list box with 3-D shading.
listBox.SetShadow(true);

//Saves the file.
workbook.Save(u"tstlistbox.xls");

Aspose::Cells::Cleanup();

See Also