public class ListSection extends Section
An object to display different lists.
[C#] //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.ListType = ListType.TableOfContents; pdf.Sections.Add(tocSection); ///create the List of Tables. Add it to the pdf like a common Section. ListSection lotSection = new ListSection("List of Tables"); lotSection.ListType = 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.ListType = ListType.ListOfFigures; pdf.Sections.Add(lofSection); //Define the format of the four levels' list. tocSection.ListFormatArray.Length = 4; tocSection.ListFormatArray[0].LeftMargin = 0; tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true; tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true; tocSection.ListFormatArray[1].LeftMargin = 10; tocSection.ListFormatArray[1].TextInfo.IsUnderline = true; tocSection.ListFormatArray[1].TextInfo.FontSize = 10; tocSection.ListFormatArray[2].LeftMargin = 20; tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true; tocSection.ListFormatArray[3].LeftMargin = 30; tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true; //Add four headings. Section sec1 = pdf.Sections.Add(); for (int Level = 1;Level != 5; Level++) { Heading heading2 = new Heading(pdf,sec1,Level); Segment segment2 = new Segment(heading2); heading2.Segments.Add(segment2); heading2.IsAutoSequence = true; segment2.Content = "this is heading of level "; segment2.Content += Level.ToString(); //Add the heading into Table Of Contents. heading2.IsInList = true; sec1.Paragraphs.Add(heading2); } //Add one table to the pdf. Table table1 = new Aspose.Pdf.Generator.Table(); sec1.Paragraphs.Add(table1); table1.ColumnWidths = "70 2cm"; table1.Title = "Table 1"; Row row1 = table1.Rows.Add(); Cell cell1Row1 = row1.Cells.Add("ColumnsSpan = 2"); cell1Row1.ColumnsSpan = 2; cell1Row1.Border = new BorderInfo((int)BorderSide.All,0.5F); Row row2 = table1.Rows.Add(); Cell cell1Row2 = row2.Cells.Add("cell1"); cell1Row2.Border = new BorderInfo((int)BorderSide.All,0.5F); Cell cell2Row2 = row2.Cells.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.IsInList = true; //Add one Image to the pdf. Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1); sec1.Paragraphs.Add(image1); image1.ImageInfo.File = "C:/118528527.jpg"; image1.ImageInfo.ImageFileType = ImageFileType.Jpeg; GraphNote note1 = new GraphNote(sec1); note1.Content = "this is note1"; note1.PositionX = 50; note1.PositionY = 100; image1.ImageNotes.Add(note1); //Add the Image to the List of Figures. image1.IsInList = true; Graph graph1 = new Graph(sec1,100,400); sec1.Paragraphs.Add(graph1); float[] posArr = new float[]{0,0,200,80,300,40,350,90}; Curve curve1 = new Curve(graph1,posArr); graph1.Shapes.Add(curve1); //Add the Graph to the List of Figures. graph1.IsInList = true; pdf.Save("TestTocXml.pdf"); [Visual Basic] '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. Dim pdf As Pdf = new Pdf() 'Create the Table Of Contents. Add it to the pdf like a common Section. Dim tocSection As ListSection = new ListSection("Table Of Contents") tocSection.ListType = ListType.TableOfContents pdf.Sections.Add(tocSection) 'create the List of Tables. Add it to the pdf like a common Section. Dim lotSection As ListSection = new ListSection("List of Tables") lotSection.ListType = ListType.ListOfTables pdf.Sections.Add(lotSection) 'create the List of Tables. Add it to the pdf like a common Section. Dim lotSection As ListSection = new ListSection("List of Tables") lotSection.ListType = ListType.ListOfTables pdf.Sections.Add(lotSection) 'create the List of Figures. Add it to the pdf like a common Section. Dim lofSection As ListSection = new ListSection("List of Figures") lofSection.ListType = ListType.ListOfFigures pdf.Sections.Add(lofSection) ///Define the format of the four levels' list. tocSection.ListFormatArray.Length = 4 tocSection.ListFormatArray(0).LeftMargin = 0 tocSection.ListFormatArray(0).TextInfo.IsTrueTypeFontBold = true tocSection.ListFormatArray(0).TextInfo.IsTrueTypeFontItalic = true tocSection.ListFormatArray(1).LeftMargin = 10 tocSection.ListFormatArray(1).TextInfo.IsUnderline = true tocSection.ListFormatArray(1).TextInfo.FontSize = 10 tocSection.ListFormatArray(2).LeftMargin = 20 tocSection.ListFormatArray(2).TextInfo.IsTrueTypeFontBold = true tocSection.ListFormatArray(3).LeftMargin = 30 tocSection.ListFormatArray(3).TextInfo.IsTrueTypeFontBold = true ///Add four headings. Dim sec1 As Section = pdf.Sections.Add() Dim Level As Int; for Level=1 To 4 Dim heading2 As Heading= new Heading(pdf,sec1,Level) Dim segment2 As Segment = new Segment(heading2) heading2.Segments.Add(segment2) heading2.IsAutoSequence = true segment2.Content = "this is heading of level " segment2.Content += Level.ToString() //Add the heading into Table Of Contents. heading2.IsInList = true sec1.Paragraphs.Add(heading2) Next Level ///Add one table to the pdf. Dim table1 As Table = new Aspose.Pdf.Generator.Table() sec1.Paragraphs.Add(table1) table1.ColumnWidths = "70 2cm" table1.Title = "Table 1" Dim row1 As Row = table1.Rows.Add() Dim cell1Row1 As Cell = row1.Cells.Add("ColumnsSpan = 2") cell1Row1.ColumnsSpan = 2 cell1Row1.Border = new BorderInfo((int)BorderSide.All,0.5F) Dim row2 As Row = table1.Rows.Add() Dim cell1Row2 As Cell = row2.Cells.Add("cell1") cell1Row2.Border = new BorderInfo((int)BorderSide.All,0.5F) Dim cell2Row2 As Cell = row2.Cells.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.IsInList = true 'Add one Image to the pdf. Dim image1 As Image = new Aspose.Pdf.Generator.Image(sec1) sec1.Paragraphs.Add(image1) image1.ImageInfo.File = "C:/118528527.jpg" image1.ImageInfo.ImageFileType = ImageFileType.Jpeg Dim note1 As GraphNote = new GraphNote(sec1) note1.Content = "this is note1" note1.PositionX = 50 note1.PositionY = 100 image1.ImageNotes.Add(note1) 'Add the Image to the List of Figures. image1.IsInList = true Dim graph1 As Graph = new Graph(sec1,100,400) sec1.Paragraphs.Add(graph1) Dim posArr() As Single = New Single() {0, 0, 200, 80, 300, 40, 350, 90} Dim curve1 As Curve = New Curve(graph1, posArr) graph1.Shapes.Add(curve1) 'Add the Graph to the List of Figures. graph1.IsInList = 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>
CurColumnPosY, FirstPageNumber, IsFullPage, IsNewPageCreated, IsWidowOrphanControlSet, PagesNumber, RealFooterMarginBottom, RealPageBottom
Constructor and Description |
---|
ListSection(Pdf doc) |
ListSection(String listTitle) |
Modifier and Type | Method and Description |
---|---|
FormatArray |
getListFormatArray()
Get or set the format of the lists of all levels using the
FormatArray . |
int |
getListType()
Get or set the
ListType of the ListSection object. |
Text |
getTitle()
Get or set the
Text value of the title of ListSection . |
boolean |
isCaptionLabelNeeded()
Gets or sets a bool value that indicates whether caption label is needed in TOC.
|
void |
isCaptionLabelNeeded(boolean value) |
void |
setListFormatArray(FormatArray value) |
void |
setListType(int value) |
void |
setTitle(Text value) |
addParagraph, completeClone, deepClone, getAdditionalEvenFooter, getAdditionalEvenHeader, getAdditionalOddFooter, getAdditionalOddHeader, getBackgroundColor, getBackgroundImageFile, getBackgroundImageFixedWidth, getBackgroundImageType, getBreakParaText, getColumnInfo, getEndNoteNumberInSection, getEvenFooter, getEvenHeader, getFirstLineIndent, getFirstPageInfo, getFootNoteNumberInPage, getFootNoteNumberInSection, getGraphInfo, getID, getObjectByID, getOddFooter, getOddHeader, getPageCount, getPageInfo, getPageRotatingAngle, getParagraphs, getPdf, getStartingPageNumber, getTextInfo, getWatermark, hasColumnLine, hasColumnLine, insertFooter, insertHeader, isAutoHyphenated, isAutoHyphenated, isBackgroundImageBlackWhite, isBackgroundImageBlackWhite, isDisabled, isDisabled, isEmpty, isFirstParaWritten, isFirstParaWritten, isHasNextColumnFlag, isHasNextColumnFlag, isLandscape, isLandscape, isNewColumn, isNewColumn, isNewPage, isNewPage, isPageNumberRestarted, isPageNumberRestarted, isSameSize, isSpaced, isSpaced, isWidowOrphanControlEnabled, isWidowOrphanControlEnabled, setAdditionalEvenFooter, setAdditionalEvenHeader, setAdditionalOddFooter, setAdditionalOddHeader, setBackgroundColor, setBackgroundImageFile, setBackgroundImageFixedWidth, setBackgroundImageType, setBreakParaText, setColumnInfo, setEndNoteNumberInSection, setEvenFooter, setEvenHeader, setFirstLineIndent, setFirstPageInfo, setFootNoteNumberInPage, setFootNoteNumberInSection, setGraphInfo, setID, setOddFooter, setOddHeader, setPageCount, setPageInfo, setPageRotatingAngle, setParagraphs, setStartingPageNumber, setTextInfo
public ListSection(String listTitle)
public ListSection(Pdf doc)
public Text getTitle()
Get or set the Text
value of the title of ListSection
.
public void setTitle(Text value)
public boolean isCaptionLabelNeeded()
Gets or sets a bool value that indicates whether caption label is needed in TOC.
public void isCaptionLabelNeeded(boolean value)
public FormatArray getListFormatArray()
Get or set the format of the lists of all levels using the FormatArray
.
public void setListFormatArray(FormatArray value)
public int getListType()
Get or set the ListType
of the ListSection
object.
public void setListType(int value)
Copyright © 2016 Aspose. All Rights Reserved.