Hello,
I have this code:
ParHdr.AppendField("page number", FieldType.FieldPage).ApplyCharacterFormat(fCourier8)
ParHdr.AppendText("/").ApplyCharacterFormat(fCourier8)
ParHdr.AppendField("number of pages", FieldType.FieldNumPages).ApplyCharacterFormat(fCourier8)
ParHdr.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Right
fCourier8 is defined so:
Dim fCourier8 As New Spire.Doc.Formatting.CharacterFormat(MacroCedola)
With fCourier8
.FontName = "Courier New"
.FontSize = 8
.Bold = True
End With
fCourier8 applied to the field FieldNumPages works,
fCourier8 applied to the field FieldPage does not work.
Moreover,
I have to put the number of page/pages in a textbox to give it an exact position.
This is my code:
Dim hdr As Spire.Doc.HeaderFooter = MacroCedola.Sections(0).HeadersFooters.Header
Dim ParHdr As Paragraph = hdr.AddParagraph
Dim tbPagina As TextBox = ParHdr.AppendTextBox(55, 15)
tbPagina.Format.HorizontalPosition = 775
tbPagina.Format.VerticalPosition = 20
tbPagina.Format.LineColor = Drawing.Color.Black
tbPagina.Format.FillColor = Drawing.Color.LightGray
tbPagina.ApplyCharacterFormat(fCourier8)
Dim parPagina As Paragraph = tbPagina.Body.AddParagraph()
parPagina.AppendField("page number", FieldType.FieldPage).ApplyCharacterFormat(fCourier8)
parPagina.AppendText("/").ApplyCharacterFormat(fCourier8)
parPagina.AppendField("number of pages", FieldType.FieldNumPages).ApplyCharacterFormat(fCourier8)
parPagina.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center
parPagina.Format.Borders.Space = 0
parPagina.Format.AfterSpacing = 0
parPagina.Format.BeforeSpacing = 0
See attached the result, the number of page/pages is not well visible, there seems to be a space between the paragraph and the textbox.
Can you please help me?
thank you,
Paola