com.aspose.pdf.elements
Class Text

java.lang.Object
  extended by com.aspose.pdf.elements.PdfElementBase
      extended by com.aspose.pdf.elements.Paragraph
          extended by com.aspose.pdf.elements.Text
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Heading

public class Text
extends Paragraph

Represents a text Paragraph in a Pdf document. The space between two lines in one Paragraph is always the same.


Constructor Summary
Text(HeaderFooter hf)
          Initializes a new instance of the Text class.
Text(HeaderFooter hf, java.lang.String content)
          Initializes a new instance of the Text class.
Text(Section section)
          Initialize a new instance of the Text class.
Text(Section section, java.lang.String content)
          Initialize a new instance of the Text class.
Text(Table table)
          Initializes a new instance of the Text class.
 
Method Summary
 org.w3c.dom.Element getDOMElement()
          Gets a DOM representation of the pdf element.
 float getFirstLineIndent()
          Gets a float value that indicates the indent of the first line in a text paragraph.The unit is point.
 float getRotatingAngle()
          Gets a float value that indicates the number of degrees by which the text should be rotated anticlockwise when displayed or printed.
 Segments getSegments()
          Gets a Segments collection that indicates all segments in the text paragraph.
 TextInfo getTextInfo()
          Gets a TextInfo object that indicates the text info of the text paragraph.
 float getTextWidth()
          Gets a float value that indicates the width paragraph.The unit is point.
 boolean isAlignedByWord()
          Gets a bool value that indicates whether the text is aligned by word.
 boolean isSpaced()
          Gets a bool value that indicates whether the spaces at the begin of the text and returns in the text be shown.
 void setFirstLineIndent(float firstLineIndent)
          Sets a float value that indicates the indent of the first line in a text paragraph.The unit is point.
 void setIsAlignedByWord(boolean alignedByWord)
          Sets a bool value that indicates whether the text is aligned by word.
 void setIsSpaced(boolean isSpaced)
          Sets a bool value that indicates whether the spaces at the begin of the text and returns in the text be shown.
 void setRotatingAngle(float angle)
          Sets a float value that indicates the number of degrees by which the text should be rotated anticlockwise when displayed or printed.
 void setSegments(Segments segments)
          Sets a Segments collection that indicates all segments in the text paragraph.
 void setTextInfo(TextInfo textInfo)
          Sets a TextInfo object that indicates the text info of the text paragraph.
 void setTextWidth(float width)
          Sets a float value that indicates the width paragraph.The unit is point.
 
Methods inherited from class com.aspose.pdf.elements.Paragraph
clone, getLeft, getMargin, getTop, isDisabled, isFirstParagraph, isKeptTogether, isOnOddPage, setDisabled, setFirstParagraph, setKeptTogether, setLeft, setMargin, setOnOddPage, setTop
 
Methods inherited from class com.aspose.pdf.elements.PdfElementBase
getElementFactory, getID, getNameIndex, setID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Text

public Text(Section section,
            java.lang.String content)
Initialize a new instance of the Text class.

 [SampleCode]
 Pdf pdf = new Pdf();
 Section sec1 = pdf.getSections().add();
 Text text1 = new Text(sec1,"seg1 ");
 sec1.getParagraphs().add(text1);
 

Parameters:
section - The Text will inherit format info from the Section.

Text

public Text(Section section)
Initialize a new instance of the Text class.

Parameters:
section - The Text will inherit format info from the Section.

Text

public Text(HeaderFooter hf)
Initializes a new instance of the Text class.

Parameters:
hf - This constructor can inherit common property values from the specified HeaderFooter object.

Text

public Text(HeaderFooter hf,
            java.lang.String content)
Initializes a new instance of the Text class.

Parameters:
hf - This constructor can inherit common property values from the specified HeaderFooter object.
content - The content of the Text

Text

public Text(Table table)
Initializes a new instance of the Text class.

Parameters:
table - This constructor can inherit common property values(such as TextInfo) from the specified Table object.
Method Detail

getTextInfo

public TextInfo getTextInfo()
Gets a TextInfo object that indicates the text info of the text paragraph.

Returns:
Returns the TextInfo object.

setTextInfo

public void setTextInfo(TextInfo textInfo)
Sets a TextInfo object that indicates the text info of the text paragraph.

Parameters:
textInfo - The TextInfo to set.

getSegments

public Segments getSegments()
Gets a Segments collection that indicates all segments in the text paragraph.

Returns:
Returns the segments.

setSegments

public void setSegments(Segments segments)
Sets a Segments collection that indicates all segments in the text paragraph.

Parameters:
segments - The segments to set.

isSpaced

public boolean isSpaced()
Gets a bool value that indicates whether the spaces at the begin of the text and returns in the text be shown.

 [SampleCode]
 Gets or sets a bool value that indicates whether the spaces at
 the begin of the text and returns in the text be shown. 
 For the following XML: 
       
        The first line,
        The second line.
       
 If IsSpaced is false, the result will be: 
 The first line,The second line.
 If IsSpaced is true, the result will be: 
                                The first line,
                                        The second line.
 


setIsSpaced

public void setIsSpaced(boolean isSpaced)
Sets a bool value that indicates whether the spaces at the begin of the text and returns in the text be shown.


getTextWidth

public float getTextWidth()
Gets a float value that indicates the width paragraph.The unit is point.

Returns:
Returns the Text Width.

setTextWidth

public void setTextWidth(float width)
Sets a float value that indicates the width paragraph.The unit is point.

Parameters:
width - The TextWidth to set.

getFirstLineIndent

public float getFirstLineIndent()
Gets a float value that indicates the indent of the first line in a text paragraph.The unit is point.

Returns:
Returns the FirstLineIndent.

setFirstLineIndent

public void setFirstLineIndent(float firstLineIndent)
Sets a float value that indicates the indent of the first line in a text paragraph.The unit is point.

Parameters:
firstLineIndent - The m_firstLineIndent to set.

getRotatingAngle

public float getRotatingAngle()
Gets a float value that indicates the number of degrees by which the text should be rotated anticlockwise when displayed or printed. Default value is 0.

Returns:
Returns the RotatingAngle.

setRotatingAngle

public void setRotatingAngle(float angle)
Sets a float value that indicates the number of degrees by which the text should be rotated anticlockwise when displayed or printed. Default value is 0.

Parameters:
angle - The RotatingAngle to set.

isAlignedByWord

public boolean isAlignedByWord()
Gets a bool value that indicates whether the text is aligned by word. This property should be set to false when using asian language such as chinese.

Returns:
Returns the IsAlignedByWord.

setIsAlignedByWord

public void setIsAlignedByWord(boolean alignedByWord)
Sets a bool value that indicates whether the text is aligned by word. This property should be set to false when using asian language such as chinese.

Parameters:
alignedByWord - The IsAlignedByWord to set.

getDOMElement

public org.w3c.dom.Element getDOMElement()
                                  throws AsposeBaseException
Description copied from class: PdfElementBase
Gets a DOM representation of the pdf element.

Overrides:
getDOMElement in class Paragraph
Throws:
AsposeBaseException
See Also:
PdfElementBase.getDOMElement()