public class Segment extends XmlEntityWithInternals
Represents a segment in a Text
paragraph.
[Java] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); Text text1 = new Text(sec1,"seg1 "); sec1.getParagraphs().add(text1); Segment seg2 = text1.getSegments().add("seg2"); seg2.getTextInfo().setColor ( new aspose.pdf.generator.Color("Red")); seg2.getTextInfo().setFontSize ( 16); pdf1.save(...); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section> <Text> <Segment>seg1 </Segment> <Segment Color="Red" FontSize="16">seg2 </Segment> </Text> </Section> </Pdf>
Constructor and Description |
---|
Segment() |
Segment(String content)
Initializes a new instance of the
Segment class. |
Segment(String content,
TextInfo info)
Initializes a new instance of the
Segment class. |
Segment(Text text)
Initializes a new instance of the
Segment class. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone()
Clones a new
Segment object. |
String |
getContent()
Gets or sets a string that indicates the content of the text segment.
|
String |
getDateFormat()
Gets or sets a string that indicates the date format of the replaceable date symbol($D).
|
EndNote |
getEndNote()
get or set the EndNote object that indicates the endnote of the current segment.
|
FootNote |
getFootNote()
get or set the FootNote object that indicates the footnote of the current segment.
|
Hyperlink |
getHyperlink()
Gets or sets a
Hyperlink object that indicates the hyper link info of the segment. |
String |
getID()
Gets or sets a string that indicates the ID of the segment.
|
Paragraph |
getInlineParagraph()
Gets or sets a
Paragraph object that indicates the inline paragraph. |
TextInfo |
getTextInfo()
Gets or sets a
TextInfo object that indicates the text info of the segment. |
boolean |
isAutoHyphenated()
Gets or sets a bool value that indicates whehter the text is hyphenated automatically.
|
boolean |
isNumeric()
Whether the segment is numeric
|
boolean |
isSymbolReplaceable()
Whether replace symbols like $p or not.
|
void |
load(com.aspose.ms.System.Xml.XmlTextReader xmlReader,
LoadingContext context) |
void |
setAutoHyphenated(boolean value) |
void |
setContent(String value) |
void |
setDateFormat(String value) |
void |
setEndNote(EndNote value) |
void |
setFootNote(FootNote value) |
void |
setHyperlink(Hyperlink value) |
void |
setID(String value) |
void |
setInlineParagraph(Paragraph value) |
void |
setSymbolReplaceable(boolean value) |
void |
setTextInfo(TextInfo value) |
public Segment()
public Segment(String content)
Initializes a new instance of the Segment
class.
content
- The content of the segment.public Segment(String content, TextInfo info)
Initializes a new instance of the Segment
class.
content
- The content of the segment.info
- The text format info of the segment.public Segment(Text text)
Initializes a new instance of the Segment
class.
text
- Text
object.
public Object completeClone()
Clones a new Segment
object. All members are cloned.
Segment
object.public boolean isAutoHyphenated()
Gets or sets a bool value that indicates whehter the text is hyphenated automatically.
public void setAutoHyphenated(boolean value)
public TextInfo getTextInfo()
Gets or sets a TextInfo
object that indicates the text info of the segment.
public void setTextInfo(TextInfo value)
public FootNote getFootNote()
get or set the FootNote object that indicates the footnote of the current segment.
public void setFootNote(FootNote value)
public EndNote getEndNote()
get or set the EndNote object that indicates the endnote of the current segment.
public void setEndNote(EndNote value)
public String getContent()
Gets or sets a string that indicates the content of the text segment.
public void setContent(String value)
public String getDateFormat()
Gets or sets a string that indicates the date format of the replaceable date symbol($D). It's value can be "d", "D", "f", "F","g", "G","m","r","s","t", "T","u", "U","y","dddd, MMMM dd yyyy","ddd, MMM d \"'\"yy","dddd, MMMM dd","M/yy","dd-MM-yy". The default value is "d". Please refer to example of DateTime.ToString() in MSDN.
public void setDateFormat(String value)
public boolean isSymbolReplaceable()
Whether replace symbols like $p or not.
Gets or sets a bool value that indicates whether a symbol like $p is replaceable or not. Default is true.
public void setSymbolReplaceable(boolean value)
public String getID()
Gets or sets a string that indicates the ID of the segment.
public void setID(String value)
public Hyperlink getHyperlink()
Gets or sets a Hyperlink
object that indicates the hyper link info of the segment.
public void setHyperlink(Hyperlink value)
public Paragraph getInlineParagraph()
Gets or sets a Paragraph
object that indicates the inline paragraph. If this
property is set, the segment become the inline paragraph of Text and the Content
is disabled. Image
, Graph
, FormField
and
Attachment
can be used as inline paragraph.
[Java] Pdf p = new Pdf(); Section sec1 = p.getSections().add(); Text text1 = new Text(); sec1.getParagraphs().add(text1); text1.getSegments().add("This is a test for inline"); Segment seg2 = text1.getSegments().add(); Image img1 = new Image(); img1.getImageInfo().setFile ( "c:/images/logo.gif"); seg2.setInlineParagraph ( img1); p.save("d:/test/test.pdf"); [XML] <Pdf xmlns="Aspose.Pdf"> <Section> <Text> <Segment FontSize="16">This is a inline image: </Segment> <Segment> <Image File="c:\images\logo.gif" /> </Segment> </Text> </Section> </Pdf>
public void setInlineParagraph(Paragraph value)
public boolean isNumeric()
Whether the segment is numeric
public void load(com.aspose.ms.System.Xml.XmlTextReader xmlReader, LoadingContext context)
load
in class XmlEntityWithInternals
Copyright © 2014 Aspose. All Rights Reserved.