Hi
I using 6.4.0.
If we set the LeftMargin in ListFormatArray, then Pagenumber moves to right. I think the Pagenumber should stay on the right side:
Here my code:
//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.<span style="color: rgb(43, 145, 175);">Pdf</span> pdf = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Pdf</span>(); <span style="color: green;">//einstellung</span> <span style="color: rgb(43, 145, 175);">MarginInfo</span> right = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">MarginInfo</span>(); right.Right = 50; right.Left = 50; <span style="color: green;">//Create the Table Of Contents. Add it to the pdf like a common Section.</span> <span style="color: rgb(43, 145, 175);">ListSection</span> tocSection = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">ListSection</span>(<span style="color: rgb(163, 21, 21);">"Table Of Contents"</span>); tocSection.ListType = <span style="color: rgb(43, 145, 175);">ListType</span>.TableOfContents; <span style="color: green;">//Define the format of the four levels' list.</span> tocSection.ListFormatArray.Length = 4; <span style="color: green;">//tocSection.ListFormatArray[0].Margin = right;</span> tocSection.PageInfo.PageWidth = <span style="color: rgb(43, 145, 175);">PageSize</span>.A4Width; tocSection.PageInfo.Margin = right; <span style="color: green;">//tocSection.ListFormatArray[0].TabLeaderType = TabLeaderType.None;</span> <span style="color: green;">//tocSection.ListFormatArray[0].LeftMargin = 0;</span> <span style="color: green;">//tocSection.ListFormatArray[0].Margin = right;</span> <span style="color: green;">//tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;</span> <span style="color: green;">//tocSection.ListFormatArray[0].SubsequentLinesIndent = 0;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[1].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[1].SubsequentLinesIndent = 20;</span> <span style="color: green;">//tocSection.ListFormatArray[1].Margin.Right = right;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TextInfo.IsUnderline = true;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TextInfo.FontSize = 10;</span> <span style="color: green;">//tocSection.ListFormatArray[2].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[2].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//tocSection.ListFormatArray[3].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[3].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//Add four headings.</span> pdf.Sections.Add(tocSection); <span style="color: rgb(43, 145, 175);">Section</span> sec1 = pdf.Sections.Add(); <span style="color: blue;">for</span> (<span style="color: blue;">int</span> Level = 1; Level != 5; Level++) { <span style="color: rgb(43, 145, 175);">Heading</span> heading2 = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Heading</span>(pdf, sec1, Level); <span style="color: rgb(43, 145, 175);">Segment</span> segment2 = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Segment</span>(heading2); heading2.Segments.Add(segment2); heading2.HeadingType = <span style="color: rgb(43, 145, 175);">HeadingType</span>.Arab; heading2.IsAutoSequence = <span style="color: blue;">true</span>; <span style="color: blue;">if</span> (Level == 1) heading2.StartNumber = 1; heading2.IsFirstParagraph = <span style="color: blue;">true</span>; segment2.Content = <span style="color: rgb(163, 21, 21);">"this is heading of level "</span>; segment2.Content += Level.ToString(); <span style="color: green;">//Add the heading into Table Of Contents.</span> heading2.IsInList = <span style="color: blue;">true</span>; heading2.LabelWidth = 60; <span style="color: green;">//heading2.Margin = right;</span> sec1.Paragraphs.Add(heading2); } <span style="color: green;">//pdf.Save("TestTocXml.pdf");</span> <span style="color: green;">// Save the resultant PDF document</span> pdf.Save(<span style="color: rgb(163, 21, 21);">@"c:/temp/TestTocXml.pdf"</span>); System.Diagnostics.<span style="color: rgb(43, 145, 175);">Process</span>.Start(<span style="color: rgb(163, 21, 21);">@"c:/temp/TestTocXml.pdf"</span>);
//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.<span style="color: rgb(43, 145, 175);">Pdf</span> pdf = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Pdf</span>(); <span style="color: green;">//einstellung</span> <span style="color: rgb(43, 145, 175);">MarginInfo</span> right = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">MarginInfo</span>(); right.Right = 50; right.Left = 50; <span style="color: green;">//Create the Table Of Contents. Add it to the pdf like a common Section.</span> <span style="color: rgb(43, 145, 175);">ListSection</span> tocSection = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">ListSection</span>(<span style="color: rgb(163, 21, 21);">"Table Of Contents"</span>); tocSection.ListType = <span style="color: rgb(43, 145, 175);">ListType</span>.TableOfContents; <span style="color: green;">//Define the format of the four levels' list.</span> tocSection.ListFormatArray.Length = 4; <span style="color: green;">//tocSection.ListFormatArray[0].Margin = right;</span> tocSection.PageInfo.PageWidth = <span style="color: rgb(43, 145, 175);">PageSize</span>.A4Width; tocSection.PageInfo.Margin = right; <span style="color: green;">//tocSection.ListFormatArray[0].TabLeaderType = TabLeaderType.None;</span> <span style="color: green;">//tocSection.ListFormatArray[0].LeftMargin = 0;</span> <span style="color: green;">//tocSection.ListFormatArray[0].Margin = right;</span> <span style="color: green;">//tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//tocSection.ListFormatArray[0].TextInfo.IsTrueTypeFontItalic = true;</span> <span style="color: green;">//tocSection.ListFormatArray[0].SubsequentLinesIndent = 0;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[1].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[1].SubsequentLinesIndent = 20;</span> <span style="color: green;">//tocSection.ListFormatArray[1].Margin.Right = right;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TextInfo.IsUnderline = true;</span> <span style="color: green;">//tocSection.ListFormatArray[1].TextInfo.FontSize = 10;</span> <span style="color: green;">//tocSection.ListFormatArray[2].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[2].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[2].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//tocSection.ListFormatArray[3].TabLeaderType = TabLeaderType.None;</span> tocSection.ListFormatArray[3].LeftMargin = 20; <span style="color: green;">//tocSection.ListFormatArray[3].TextInfo.IsTrueTypeFontBold = true;</span> <span style="color: green;">//Add four headings.</span> pdf.Sections.Add(tocSection); <span style="color: rgb(43, 145, 175);">Section</span> sec1 = pdf.Sections.Add(); <span style="color: blue;">for</span> (<span style="color: blue;">int</span> Level = 1; Level != 5; Level++) { <span style="color: rgb(43, 145, 175);">Heading</span> heading2 = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Heading</span>(pdf, sec1, Level); <span style="color: rgb(43, 145, 175);">Segment</span> segment2 = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">Segment</span>(heading2); heading2.Segments.Add(segment2); heading2.HeadingType = <span style="color: rgb(43, 145, 175);">HeadingType</span>.Arab; heading2.IsAutoSequence = <span style="color: blue;">true</span>; <span style="color: blue;">if</span> (Level == 1) heading2.StartNumber = 1; heading2.IsFirstParagraph = <span style="color: blue;">true</span>; segment2.Content = <span style="color: rgb(163, 21, 21);">"this is heading of level "</span>; segment2.Content += Level.ToString(); <span style="color: green;">//Add the heading into Table Of Contents.</span> heading2.IsInList = <span style="color: blue;">true</span>; heading2.LabelWidth = 60; <span style="color: green;">//heading2.Margin = right;</span> sec1.Paragraphs.Add(heading2); } <span style="color: green;">//pdf.Save("TestTocXml.pdf");</span> <span style="color: green;">// Save the resultant PDF document</span> pdf.Save(<span style="color: rgb(163, 21, 21);">@"c:/temp/TestTocXml.pdf"</span>); System.Diagnostics.<span style="color: rgb(43, 145, 175);">Process</span>.Start(<span style="color: rgb(163, 21, 21);">@"c:/temp/TestTocXml.pdf"</span>);
Regards Markus