public class ListSection extends Section
An object to display different lists.
[Java] //The ListSection has set a default FormatArray of three levels. //The user can use the default three levels' list without the pain of defining the list's format. //But if you want to define your own list format, you should define it before using the list like the example. pdf = new Pdf(); //Create the Table Of Contents. Add it to the pdf like a common Section. ListSection tocSection = new ListSection("Table Of Contents"); tocSection.setListType ( ListType.TableOfContents); pdf.getSections().add(tocSection); ///create the List of Tables. Add it to the pdf like a common Section. ListSection lotSection = new ListSection("List of Tables"); lotSection.setListType ( ListType.ListOfTables); pdf.Sections.Add(lotSection); ///create the List of Figures. Add it to the pdf like a common Section. ListSection lofSection = new ListSection("List of Figures"); lofSection.setListType ( ListType.ListOfFigures); pdf.getSections().add(lofSection); //Define the format of the four levels' list. tocSection.getListFormatArray().setLength ( 4); tocSection.getListFormatArray().get_Item(0).LeftMargin = 0; tocSection.getListFormatArray().get_Item(0).TextInfo.IsTrueTypeFontBold = true; tocSection.getListFormatArray().get_Item(0).TextInfo.IsTrueTypeFontItalic = true; tocSection.getListFormatArray().get_Item(1).LeftMargin = 10; tocSection.getListFormatArray().get_Item(1).TextInfo.IsUnderline = true; tocSection.getListFormatArray().get_Item(1).TextInfo.FontSize = 10; tocSection.getListFormatArray().get_Item(2).LeftMargin = 20; tocSection.getListFormatArray().get_Item(2).TextInfo.IsTrueTypeFontBold = true; tocSection.getListFormatArray().get_Item(3).LeftMargin = 30; tocSection.getListFormatArray().get_Item(3).TextInfo.IsTrueTypeFontBold = true; //Add four headings. Section sec1 = pdf.getSections().add(); for (int Level = 1;Level != 5; Level++) { Heading heading2 = new Heading(pdf,sec1,Level); Segment segment2 = new Segment(heading2); heading2.getSegments.add(segment2); heading2.setIsAutoSequence ( true); segment2.setContent ( "this is heading of level "); segment2.setContent (segment2.getContent() + Level.ToString()); //Add the heading into Table Of Contents. heading2.setIsInList ( true); sec1.getParagraphs().add(heading2); } //Add one table to the pdf. Table table1 = new aspose.pdf.generator.Table(); sec1.Paragraphs.Add(table1); table1.setColumnWidths ( "70 2cm"0; table1.setTitle ( "Table 1"); Row row1 = table1.getRows().add(); Cell cell1Row1 = row1.getCells.add("ColumnsSpan = 2"); cell1Row1.ColumnsSpan = 2; cell1Row1.setBorder ( new BorderInfo((int)BorderSide.All,0.5f)); Row row2 = table1.getRows().add(); Cell cell1Row2 = row2.getCells().add("cell1"); cell1Row2.setBorder ( new BorderInfo((int)BorderSide.All,0.5f)); Cell cell2Row2 = row2.getCells().add("cell2"); cell2Row2.Border = new BorderInfo((int)BorderSide.All,0.5f,new aspose.pdf.generator.Color("Red")); //Add the table to the List of Tables. table1.setIsInList ( true); //Add one Image to the pdf. aspose.pdf.generator.Image image1 = new aspose.pdf.generator.Image(sec1); sec1.getParagraphs().add(image1); image1.getImageInfo().setFile ( "C:/118528527.jpg"); image1.getImageInfo().setImageFileType ( ImageFileType.Jpeg); GraphNote note1 = new GraphNote(sec1); note1.setContent ( "this is note1"); note1.setPositionX ( 50); note1.setPositionY ( 1000; image1.getImageNotes().add(note1); //Add the Image to the List of Figures. image1.IsInList = true; Graph graph1 = new Graph(sec1,100,400); sec1.getParagraphs().add(graph1); float[] posArr = new float[]{0,0,200,80,300,40,350,90}; Curve curve1 = new Curve(graph1,posArr); graph1.getShapes().add(curve1); //Add the Graph to the List of Figures. graph1.setIsInList ( true); pdf.save("TestTocXml.pdf"); [XML] <?xml version="1.0" encoding="utf-8"?> <Pdf> <ListSection ListType="TableOfContents"> <Title Alignment="Center"> <Segment IsTrueTypeFontBold="true" FontSize="30"> TableOfContents </Segment> </Title> <ListLevelFormat Level="1" LeftMargin="0"> <TextInfo IsTrueTypeFontBold="true" IsTrueTypeFontItalic="true"> </TextInfo> </ListLevelFormat> <ListLevelFormat Level="2" LeftMargin="10"> <TextInfo IsUnderline="true" FontSize="10"> </TextInfo> </ListLevelFormat> <ListLevelFormat Level="3" LeftMargin="20"> <TextInfo IsTrueTypeFontBold="true"> </TextInfo> </ListLevelFormat> <ListLevelFormat Level="4" LeftMargin="30"> <TextInfo IsTrueTypeFontBold="true"> </TextInfo> </ListLevelFormat> </ListSection> <ListSection ListType="ListOfTables"> <Title> <Segment IsTrueTypeFontBold="true" FontSize="30">ListOfTables</Segment> </Title> </ListSection> <ListSection ListType="ListOfFigures"> <Title> <Segment IsTrueTypeFontBold="true" FontSize="30">ListOfFigures</Segment> </Title> </ListSection> <Section> <Heading level="1" IsAutoSequence="true" IsInList="true"> <Segment>this is heading of level 1</Segment> </Heading> <Heading level="2" IsAutoSequence="true" IsInList="true"> <Segment>this is heading of level 2</Segment> </Heading> <Heading level="3" IsAutoSequence="true" IsInList="true"> <Segment>this is heading of level 3</Segment> </Heading> <Heading level="4" IsAutoSequence="true" IsInList="true"> <Segment>this is heading of level 4</Segment> </Heading> <Table ColumnWidths="70 2cm" IsInList="true"> <Row> <Cell ColumnsSpan="2"> <Border> <All LineWidth="0.5"/> </Border> <Text> <Segment>ColumnsSpan = 2</Segment> </Text> </Cell> </Row> <Row> <Cell> <Border> <All LineWidth="0.5"/> </Border> <Text> <Segment>cell1</Segment> </Text> </Cell> <Cell> <Border> <All LineWidth="0.5" Color="Red"/> </Border> <Text> <Segment>cell2</Segment> </Text> </Cell> </Row> </Table> <Image File="C:/118528527.jpg" Type="jpeg" IsInList="true"> <Note Position="50 100">this is note1</Note> <Title>mm picture</Title> </Image> <Graph Height="100" Width="400" IsInList="true"> <Curve Position="0 0 200 80 300 40 350 90"/> <Title>one curve</Title> </Graph> </Section> </Pdf>
Modifier and Type | Field and Description |
---|---|
int |
_ListType
Get or set the
ListType of the ListSection object. |
boolean |
IsCaptionLabelNeeded
Gets or sets a bool value that indicates whether caption label is needed in TOC.
|
FormatArray |
ListFormatArray
Get or set the format of the lists of all levels using the
FormatArray . |
Text |
Title
Get or set the
Text value of the title of ListSection . |
AdditionalEvenFooter, AdditionalEvenHeader, AdditionalOddFooter, AdditionalOddHeader, BackgroundColor, BackgroundImageFile, BackgroundImageFixedWidth, BackgroundImageType, ColumnCount, ColumnSpacing, ColumnWidths, EvenFooter, EvenHeader, FirstLineIndent, FirstPageInfo, GraphInfo, HasColumnLine, ID, IsAutoHyphenated, IsBackgroundImageBlackWhite, IsDisabled, IsLandscape, IsNewColumn, IsNewPage, IsPageNumberRestarted, IsSpaced, IsWidowOrphanControlEnabled, OddFooter, OddHeader, PageInfo, PageRotatingAngle, Paragraphs, StartingPageNumber, TextInfo
Constructor and Description |
---|
ListSection(LegacyPdf parentDocIfAny)
Initializes a new instance of the
ListSection class . |
ListSection(String listTitle)
Initializes a new instance of the
ListSection class . |
public Text Title
Get or set the Text
value of the title of ListSection
.
public boolean IsCaptionLabelNeeded
Gets or sets a bool value that indicates whether caption label is needed in TOC.
public FormatArray ListFormatArray
Get or set the format of the lists of all levels using the FormatArray
.
public int _ListType
Get or set the ListType
of the ListSection
object.
public ListSection(String listTitle)
Initializes a new instance of the ListSection
class .
listTitle
- Title of created section.public ListSection(LegacyPdf parentDocIfAny)
Initializes a new instance of the ListSection
class .
parentDocIfAny
- Parent legacy document(if any)of created section.Copyright © 2014 Aspose. All Rights Reserved.