Hi
i can not set the right Margin on a TOC. please see the example Code. i can set the rigth marin to any value, it hase no effect to the Document
//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 pdf = new Pdf();
//einstellung
MarginInfo right = new MarginInfo();
right.Right = 100;
right.Left = 50;
//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);
lotSection.PageInfo.Margin = right;
///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;
//MarginInfo right = new MarginInfo();
//right.Right = 40;
//tocSection.ListFormatArray[0].Margin = right;
tocSection.PageInfo.PageWidth = PageSize.A4Width;
//right.Top = 20;
tocSection.PageInfo.Margin = right;
tocSection.ListFormatArray[0].TabLeaderType = TabLeaderType.None;
//tocSection.ListFormatArray[0].LeftMargin = 0;
//tocSection.ListFormatArray[0].Margin.Right = 50;
tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;
tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;
tocSection.ListFormatArray[0].SubsequentLinesIndent = 0;
//tocSection.ListFormatArray[1].LeftMargin = 5;
tocSection.ListFormatArray[1].TextInfo.IsUnderline = true;
tocSection.ListFormatArray[1].TextInfo.FontSize = 10;
//tocSection.ListFormatArray[2].LeftMargin = 10;
tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;
//tocSection.ListFormatArray[3].LeftMargin = 15;
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;
heading2.LabelWidth = 60;
//heading2.Margin = right;
sec1.Paragraphs.Add(heading2);
}
//Add one table to the pdf.
Table table1 = new Aspose.Pdf.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.Color("Red"));
//Add the table to the List of Tables.
table1.IsInList = true;
//pdf.Save("TestTocXml.pdf");
// Save the resultant PDF document
pdf.Save(@"Z:/pdftest/TestTocXml.pdf");
Regards Markus