We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Right align page numbers i TOC

Hi 'Aspose'

Sorry, but I am not able to find this in the documentation.

How do I right align, the page numbers from page 2 to 9 in the Table Of Content ?

Below is my example code:

I just made a windos form with one buttom.

Private Sub pbTOC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbTOC.Click

Dim myPDF As Pdf = New Pdf()

Dim tocSection As ListSection = New ListSection(myPDF)
tocSection.IsLandscape = False
tocSection.IsNewPage = True
tocSection.TextInfo.FontName = "Verdana"
tocSection.TextInfo.FontSize = 9
tocSection.ListFormatArray.Length = 2
tocSection.ListFormatArray(0).TextInfo.FontName = "Verdana"
tocSection.ListFormatArray(0).TextInfo.FontSize = 9
tocSection.ListFormatArray(0).LeftMargin = 0
tocSection.ListFormatArray(0).TextInfo.IsTrueTypeFontBold = True
tocSection.ListFormatArray(0).TextInfo.IsTrueTypeFontItalic = False
tocSection.ListFormatArray(0).TabLeaderType = TabLeaderType.None
tocSection.ListFormatArray(0).SubsequentLinesIndent = 0
tocSection.ListFormatArray(1).TextInfo.FontName = "Verdana"
tocSection.ListFormatArray(1).TextInfo.FontSize = 9
tocSection.ListFormatArray(1).LeftMargin = 0
tocSection.ListFormatArray(1).TextInfo.IsTrueTypeFontBold = True
tocSection.ListFormatArray(1).TextInfo.IsTrueTypeFontItalic = False
tocSection.ListFormatArray(1).TabLeaderType = TabLeaderType.None
tocSection.ListFormatArray(1).SubsequentLinesIndent = 0

For ix As Integer = 0 To 15
Dim newSection As Section = New Section()
Dim newHeading As Heading = New Heading(myPDF, newSection, 1)
newHeading.TextInfo.FontName = "Verdana"
newHeading.TextInfo.FontSize = 9.0F
newHeading.TextInfo.IsBaseline = True
newHeading.IsPrefixed = False
newHeading.IsInList = True
newHeading.UserLabel = ""
newHeading.LabelWidth = 0
Dim newSegment As Segment = New Segment("This is heading level 1 at page: " & (ix + 2).ToString)
newSegment.TextInfo.FontName = "Verdana"
newSegment.TextInfo.FontSize = 9



Catch ex As Exception
End Try
End Sub


Martti Wienke

Hello Martti,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

I am sorry to inform you that, your required feature is not supported in the current version. I have contacted the development to see if we can support this feature or not.

Dear Martti,

Thanks for your inquiry.
It is a known issue. I am afraid we can’t support it in the near future. Sorry for inconvenience.

Best regards.