Hello all,
Perhaps I'm just missing the obvious here, but I'm having trouble changing the font size of a PageField in my RadDocument's Header. I can add a Span into the same Paragraph containing the PageField and change the styling of that, but I'm unable to change the style of the PageField itself.
Here's how I'm currently adding the PageNumbers to the Document. Any help/suggestions would be great. Thanks.
Header header = new Header();
RadDocument doc = new RadDocument();
Section sec = new Section();
Paragraph para = new Paragraph() { TextAlignment = Telerik.Windows.Documents.Layout.RadTextAlignment.Right };
FieldRangeStart fieldStart = new FieldRangeStart();
FieldRangeEnd fieldEnd = new FieldRangeEnd();
fieldEnd.PairWithStart(fieldStart);
fieldStart.Field = new PageField();
fieldStart.Field.DisplayMode = FieldDisplayMode.Result;
para.Children.Add(fieldStart);
para.Children.Add(fieldEnd);
sec.Children.Add(para);
doc.Sections.Add(sec);
header.Body = doc;
radRTB.HeaderFooterUIContext.UpdateHeader(radRTB.Document.Sections.First, HeaderFooterType.Default, header);
6 Answers, 1 is accepted
After some more digging around, I think that I need is to change the Fontsize of the Span that is returned as a ResultFragment from the FIeldRangeStart element.
I was able to dig down through the elements while debugging and saw that the default size of this span is 16 even though the Fontsize of the Paragraph that contains it is set to 12.
Is there a way to force the Paragraph's Inlines to adhere to it's settings?
At this point, there is no way to set the font settings of the PageField in the header. The Telerik points in your account have been updated in appreciation of your bug report and the detailed inspection you have carried out.
I am also creating a PITS issue, which you can use to track our progress on this item.
You can follow the PITS Issue by its ID: 7860
Here you can find the PITS Issue: Public URL
Iva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
We have changed the behavior of fields with regard to styles: in the latest version, the style of the field is extracted from its result (or more specifically, the first Span of its contents). This style is persisted through the document and when exported/imported.
Changing the formatting of the field can be done both programmatically and from the UI. This should suit your case, but feel free to contact us if you have any comments.
Regards,
Ivailo Karamanolev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
The Span that Ivailo mentions must be in the field range, between the FieldRangeStart and FieldRangeEnd element. You can refer to this forum thread for sample code how this can be achieved when creating the document in code-behind.
If you are adding the page field from the UI, it will take the current style of the document. You can test that in the online demo.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.