This is a migrated thread and some comments may be shown as answers.
How to set the font for page numbers
2 Answers 37 Views
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 27 Jul 2012, 09:02 PM
I know there must be a way to set the font of the page numbers generated by PageField, but I can't figure it out.  Also, there are 3 formatting strings, but I can't find any documentation on how they are used.
Thanks,
Steve

2 Answers, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 01 Aug 2012, 05:31 PM
Hello Steve,

The setting of the style of the fields is indeed not very intuitive. What you can do is create a span with the desired formatting and add it between the field start and field end. It will be used by the field to retrieve the formatting, but the value of the text will be overwritten in order to show the result of the field: 

Paragraph paragraph = new Paragraph();
PageField pageField = new PageField()
{
    DisplayMode = FieldDisplayMode.Result
};
FieldRangeStart pageFieldStart = new FieldRangeStart();
pageFieldStart.Field = pageField;
FieldRangeEnd pageFieldEnd = new FieldRangeEnd();
pageFieldEnd.Start = pageFieldStart;
paragraph.Inlines.Add(pageFieldStart);
paragraph.Inlines.Add(new Span("1") { FontSize = 9});
paragraph.Inlines.Add(pageFieldEnd);

As for the other matter, I believe you are refering to PageFields'  properties DateTimeFormatting, NumericFormatting and GeneralFormatting. They are used mostly internally or when implementing a custom Field and can't be used for styling the page field.  Regards,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Steve
Top achievements
Rank 1
answered on 01 Aug 2012, 05:54 PM
Worked like a charm!
Thanks,
Steve
Asked by
Steve
Top achievements
Rank 1
Answers by
Petya
Telerik team
Steve
Top achievements
Rank 1
Share this question
or