public class TextBox extends Shape
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");
| Modifier and Type | Method and Description |
|---|---|
EquationNode |
getEquationParagraph()
Gets the first math paragraph from the TextBody property of the TextBox object.
|
EquationNode |
getEquationParagraph(int index)
Get the specified math paragraph from the TextBody property of the TextBox object.
|
addHyperlink, alignTopRightCorner, calculateTextSize, characters, fitToTextSize, formatCharacters, getActiveXControl, getActualBox, getActualLowerRightRow, getAlternativeText, getAnchorType, getAutoShapeType, getBottom, getCharacters, getConnectionPoints, getControlData, getCreateId, getFill, getFillFormat, getFont, getFormatPicture, getGeometry, getGlow, getGroup, getHeight, getHeightCM, getHeightInch, getHeightInShape, getHeightPt, getHeightScale, getHtmlText, getHyperlink, getId, getInputRange, getInputRange, getLeft, getLeftCM, getLeftInch, getLeftInShape, getLeftToCorner, getLine, getLineFormat, getLinkedCell, getLinkedCell, getLockedProperty, getLowerDeltaX, getLowerDeltaY, getLowerRightColumn, getLowerRightRow, getMacroName, getMsoDrawingType, getName, getPaths, getPlacement, getReflection, getRelativeToOriginalPictureSize, getResultOfSmartArt, getRichFormattings, getRight, getRotationAngle, getShadowEffect, getSoftEdges, getSpid, getSpt, getText, getTextBody, getTextBoxOptions, getTextDirection, getTextEffect, getTextHorizontalAlignment, getTextHorizontalOverflow, getTextOptions, getTextOrientationType, getTextShapeType, getTextVerticalAlignment, getTextVerticalOverflow, getThreeDFormat, getTitle, getTop, getTopCM, getTopInch, getTopInShape, getTopToCorner, getType, getUpperDeltaX, getUpperDeltaY, getUpperLeftColumn, getUpperLeftRow, getWidth, getWidthCM, getWidthInch, getWidthInShape, getWidthPt, getWidthScale, getWorksheet, getX, getY, getZOrderPosition, hasLine, isAspectRatioLocked, isDecorative, isEquation, isFilled, isFlippedHorizontally, isFlippedVertically, isGroup, isHidden, isInGroup, isLockAspectRatio, isLocked, isPrintable, isRichText, isSameSetting, isSmartArt, isTextWrapped, isWordArt, moveToRange, removeActiveXControl, removeHyperlink, setAlternativeText, setAnchorType, setAspectRatioLocked, setAutoShapeType, setBottom, setCreateId, setDecorative, setFilled, setFlippedHorizontally, setFlippedVertically, setFont, setHasLine, setHeight, setHeightCM, setHeightInch, setHeightInShape, setHeightPt, setHeightScale, setHidden, setHtmlText, setInputRange, setInputRange, setLeft, setLeftCM, setLeftInch, setLeftInShape, setLeftToCorner, setLinkedCell, setLinkedCell, setLockAspectRatio, setLocked, setLockedProperty, setLowerDeltaX, setLowerDeltaY, setLowerRightColumn, setLowerRightRow, setMacroName, setName, setPlacement, setPrintable, setRelativeToOriginalPictureSize, setRight, setRotationAngle, setSoftEdges, setText, setTextDirection, setTextHorizontalAlignment, setTextHorizontalOverflow, setTextOptions, setTextOrientationType, setTextShapeType, setTextVerticalAlignment, setTextVerticalOverflow, setTextWrapped, setTitle, setTop, setTopCM, setTopInch, setTopInShape, setTopToCorner, setUpperDeltaX, setUpperDeltaY, setUpperLeftColumn, setUpperLeftRow, setWidth, setWidthCM, setWidthInch, setWidthInShape, setWidthPt, setWidthScale, setX, setY, setZOrderPosition, toFrontOrBack, toImage, toImage, toImage, updateSelectedValuepublic EquationNode getEquationParagraph(int index)
index - The position index of the math paragraph, starting from 0.public EquationNode getEquationParagraph()
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.