Centering and font size of header/footer?


#1

with the following code why does my header not align in the center and the font size not change?

Dim hf As New HeaderFooter

Dim headerinfo As New TextInfo

headerinfo.Alignment = AlignmentType.Center

headerinfo.FontSize = 14

hf.IsFirstPageOnly = False

hf.TextInfo = headerinfo

Dim headertext As New Aspose.Pdf.Text(“Monthly Performance”)

Dim head2 As New Aspose.Pdf.Text(CStr(Session(“clienttitle”)))

hf.Paragraphs.Add(headertext)

hf.Paragraphs.Add(head2)

sec1.OddHeader = hf

sec1.EvenHeader = hf


#2

Dear bsarram,

Thank you for considering Aspose.

You should use the following code to make sure the Text objectg inherit font info from HeaderFooter object:

Dim headertext As New Aspose.Pdf.Text(hf, “Monthly Performance”)


Or you can use the following code to make sure the Text object use the font info you have defined:

Dim headertext As New Aspose.Pdf.Text(“Monthly Performance”, headerinfo)


#3

Dear bsarram,

Thank you for considering Aspose.

In the current version, you have to specify explicitly which object ( section,headerfooter or tablecell) will the Text object inherit text format info from. Maybe you are right and your code is logical. I will consider improving this to make text object automatically inherit format info.


#4

Tommy thanks, yes I see the logic in the way aspose inherits the textinfo but then it wouldnt make sense to have textinfo property available for header object, so yes if you can I think it would be easier either not to make textinfo available to header or like you said make it so the inheritance goes all the way through…