Encapsulates the object that represents a textbox in a spreadsheet.
Example:
//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the book.
Worksheet worksheet = workbook.getWorksheets().get(0);
//Add a new textbox to the collection.
int textboxIndex = worksheet.getTextBoxes().add(2, 1, 160, 200);
//Get the textbox object.
TextBox textbox0 = worksheet.getTextBoxes().get(textboxIndex);
//Fill the text.
textbox0.setText("ASPOSE______The .NET and JAVA Component Publisher!");
//Set the textbox to adjust it according to its contents.
textbox0.getTextBody().getTextAlignment().setAutoSize(true);
//Set the placement.
textbox0.setPlacement(PlacementType.FREE_FLOATING);
//Set the font color.
textbox0.getFont().setColor(Color.getBlue());
//Set the font to bold.
textbox0.getFont().setBold(true);
//Set the font size.
textbox0.getFont().setSize(14);
//Set font attribute to italic.
textbox0.getFont().setItalic(true);
//Add a hyperlink to the textbox.
textbox0.addHyperlink("http://www.aspose.com/");
//Get the filformat of the textbox.
FillFormat fillformat = textbox0.getFill();
//Set the fillcolor.
fillformat.getSolidFill().setColor(Color.getSilver());
//Get the lineformat type of the textbox.
LineFormat lineformat = textbox0.getLine();
//Set the line style.
lineformat.setCompoundType(MsoLineStyle.THIN_THICK);
//Set the line weight.
lineformat.setWeight(6);
//Set the dash style to squaredot.
lineformat.setDashStyle(MsoLineDashStyle.SQUARE_DOT);
//Add another textbox.
textboxIndex = worksheet.getTextBoxes().add(15, 4, 85, 120);
//Get the second textbox.
TextBox textbox1 = worksheet.getTextBoxes().get(textboxIndex);
//Input some text to it.
textbox1.setText("This is another simple text box");
//Set the placement type as the textbox will move and
//resize with cells.
textbox1.setPlacement(PlacementType.MOVE_AND_SIZE);
//Save the excel file.
workbook.save("tsttextboxes.xlsx");
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;
Represents the way the drawing object is attached to the cells below it.
The property controls the placement of an object on a worksheet.
The value of the property is PlacementType integer constant.
Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.
Applies to Shape objects that represent WordArt.
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;
Returns a MsoLineFormat object that contains line formatting properties for the specified shape.
NOTE: This member is now obsolete. Instead,
please use Shape.Line property.
This property will be removed 12 months later since July 2016.
Aspose apologizes for any inconvenience you may have experienced.
Returns a MsoFillFormat object that contains fill formatting properties for the specified shape.
NOTE: This member is now obsolete. Instead,
please use Shape.Fill property.
This property will be removed 12 months later since July 2016.
Aspose apologizes for any inconvenience you may have experienced.
Represents the setting of the shape's formatting.
NOTE: This member is now obsolete. Instead,
please use Shape.Fill and Shape.Line properties.
This property will be removed 6 months later since August 2016.
Aspose apologizes for any inconvenience you may have experienced.
Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape.
NOTE: This member is now obsolete. Instead,
please use Shape.TextBody.TextAlignment property.
This property will be removed 12 months later since May 2016.
Aspose apologizes for any inconvenience you may have experienced.
Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.
Applies to Shape objects that represent WordArt.
public int getPlacement() / public void setPlacement(int 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.
The value of the property is PlacementType integer constant.
Example:
if (shape.getPlacement() == PlacementType.MOVE)
shape.setPlacement(PlacementType.MOVE_AND_SIZE);
public int getTop() / public void setTop(int value)
Represents the vertical offset of shape from its top row, in unit of pixels.
If the shape is in the chart, represents the vertical offset of shape from its top border.
public int getWidthScale() / public void setWidthScale(int 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;
Example:
if (shape.getWidthScale() == 3)
shape.setWidthScale(1);
public int getHeightScale() / public void setHeightScale(int 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;
Example:
if (shape.getHeightScale() == 3)
shape.setHeightScale(1);
public int getTopInShape() / public void setTopInShape(int 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.
Only Applies when this shape in the group or chart.
Example:
if (shape.getTopInShape() == 8000)
shape.setTopInShape(4000);
public int getLeftInShape() / public void setLeftInShape(int 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.
Only Applies when this shape in the group or chart.
Example:
if (shape.getUpperDeltaY() == 2000)
shape.setUpperDeltaY(4000);
public int getHeightInShape() / public void setHeightInShape(int 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..
Only Applies when this shape in the group or chart.
Example:
if (shape.getUpperDeltaY() == 4000)
shape.setUpperDeltaY(2000);
public int getHeightInChart() / public void setHeightInChart(int 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..
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.HeightInShape property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public int getLeftInChart() / public void setLeftInChart(int value)
Represents the vertical offset of shape from the left border of the parent shape, in unit of 1/4000 of width of the parent shape.
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.LeftInShape property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public int getTopInChart() / public void setTopInChart(int 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.
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.TopInShape property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public int getWidthInChart() / public void setWidthInChart(int value)
Represents the width of the shape, in unit of 1/4000 of the parent shape.
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.WidthInShape property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public int getPositionX() / public void setPositionX(int value)
Gets and sets the horizonal offset of shape from worksheet left border,in unit of pixels.
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.X property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public int getPositionY() / public void setPositionY(int value)
Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels.
NOTE: This member is now obsolete. Instead,
please use Aspose.Cells.Drawing.Shape.Y property.
This property will be removed 12 months later since JANUARY 2012.
Aspose apologizes for any inconvenience you may have experienced.
public java.awt.geom.Point2D.Float[] getConnectionPoints()
Get the connection points
NOTE: This member is now obsolete. Instead,
please use GetConnectionPoints() method.
This method will be removed 12 months later since April 2022.
Aspose apologizes for any inconvenience you may have experienced.
public int getTextVerticalOverflow() / public void setTextVerticalOverflow(int value)
Gets and sets the text vertical overflow type of the shape which contains text.
The value of the property is TextOverflowType integer constant.
Example:
if (shape.getTextVerticalOverflow() == com.aspose.cells.TextOverflowType.CLIP)
shape.setTextVerticalOverflow(com.aspose.cells.TextOverflowType.OVERFLOW);
public int getTextHorizontalOverflow() / public void setTextHorizontalOverflow(int value)
Gets and sets the text horizontal overflow type of the shape which contains text.
The value of the property is TextOverflowType integer constant.
Example:
if (shape.getTextHorizontalOverflow() == com.aspose.cells.TextOverflowType.CLIP)
shape.setTextHorizontalOverflow(com.aspose.cells.TextOverflowType.OVERFLOW);
public int getTextOrientationType() / public void setTextOrientationType(int value)
Gets and sets the text orientation type of the shape.
The value of the property is TextOrientationType integer constant.
Example:
if (shape.getTextOrientationType() == com.aspose.cells.TextOrientationType.NO_ROTATION)
shape.setTextOrientationType(com.aspose.cells.TextOrientationType.TOP_TO_BOTTOM);
public int getTextHorizontalAlignment() / public void setTextHorizontalAlignment(int value)
Gets and sets the text horizontal alignment type of the shape.
The value of the property is TextAlignmentType integer constant.
Example:
if (shape.getTextHorizontalAlignment() == com.aspose.cells.TextAlignmentType.BOTTOM)
shape.setTextHorizontalAlignment(com.aspose.cells.TextAlignmentType.CENTER);
public int getTextVerticalAlignment() / public void setTextVerticalAlignment(int value)
Gets and sets the text vertical alignment type of the shape.
The value of the property is TextAlignmentType integer constant.
Example:
if (shape.getTextVerticalAlignment() == com.aspose.cells.TextAlignmentType.BOTTOM)
shape.setTextVerticalAlignment(com.aspose.cells.TextAlignmentType.CENTER);
CheckBoxActiveXControl checkBox1 = (CheckBoxActiveXControl)shape.getActiveXControl();
//The font name of CheckBox
String fontName = checkBox1.getFont().getName();
public void setLinkedCell(java.lang.String formula, boolean isR1C1, boolean isLocal)
Sets the range linked to the control's value.
Parameters:
formula - The range linked to the control's value.
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
Example:
//After executing the code below, a ScrollBar object is created in the generated file. As you drag the slider, the value is displayed in cell A12.
//ActiveX Controls
//Aspose.Cells.Drawing.Shape scrollBar = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ScrollBar,2, 0, 2, 0, 30, 130);
//Form Controls
Shape scrollBar = book.getWorksheets().get(0).getShapes().addScrollBar(2, 0, 2, 0, 130, 30);
//Sets the range linked to the control's value.
scrollBar.setLinkedCell("$A$12", false, true);
public void setInputRange(java.lang.String formula, boolean isR1C1, boolean isLocal)
Sets the range used to fill the control.
Parameters:
formula - The range used to fill the control.
isR1C1 - Whether the formula needs to be formatted as R1C1.
isLocal - Whether the formula needs to be formatted by locale.
Example:
//After executing the code below, a ListBox object is created in the generated file. When the selected option is clicked, the selected value is displayed in cell A12.
//Initialize a new workbook.
//Workbook book = new Workbook();
for (int i = 0; i< 10; ++i)
{
Cell cell = book.getWorksheets().get(0).getCells().get(i, 0);
cell.setValue(i + 1);
}
//Create a ListBox object
//ActiveX Controls
//Aspose.Cells.Drawing.Shape listBox = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ListBox,2, 0, 2, 0, 130, 130);
//Form Controls
Shape listBox = book.getWorksheets().get(0).getShapes().addListBox(2, 0, 2, 0, 130, 130);
//Sets the range used to fill the control.
listBox.setInputRange("$A$1:$A$6", false, false);
//Sets the range linked to the control's value.
listBox.setLinkedCell("$A$12", false, true);
public void updateSelectedValue()
throws java.lang.Exception
Update the selected value by the value of the linked cell.
Example:
//Initialize a new workbook.
//Workbook book = new Workbook();
Cell cell = null;
for (int i = 0; i< 10; ++i)
{
cell = book.getWorksheets().get(0).getCells().get(i, 0);
cell.setValue(i + 1);
}
//Create a ListBox object
//ActiveX Controls
//Aspose.Cells.Drawing.Shape listBox = book.Worksheets[0].Shapes.AddActiveXControl( Aspose.Cells.Drawing.ActiveXControls.ControlType.ListBox,2, 0, 2, 0, 130, 130);
//Form Controls
Shape listBox = book.getWorksheets().get(0).getShapes().addListBox(2, 0, 2, 0, 130, 130);
//Sets the range used to fill the control.
listBox.setInputRange("$A$1:$A$6", false, false);
//Sets the range linked to the control's value.
listBox.setLinkedCell("$A$12", false, true);
ListBox listbx = (ListBox)listBox;
//Set the value of cell A12
cell = book.getWorksheets().get(0).getCells().get(11, 0);
cell.setValue(3);
//Update the selected value by the value of the linked cell.
listBox.updateSelectedValue();
//-1 default, no option selected
if(listbx.isSelected(2))
{
//Option 3 of the ListBox is selected
}
//Change the value of a linked cell
cell.setValue(4);
//Update the selected value by the value of the linked cell.
listBox.updateSelectedValue();
if(listbx.isSelected(3))
{
//Option 4 of the ListBox is selected
}
public void formatCharacters(int startIndex, int length, Font font)
Formats some characters with the font setting.
NOTE: This member is now obsolete. Instead,
please use Shape.FormatCharacters(int startIndex, int length, Font font, StyleFlag flag) method.
This property will be removed 12 months later since March 2016.
Aspose apologizes for any inconvenience you may have experienced.