Problem with styling page number in the exported document.

2 posts, 0 answers
  1. john
    john avatar
    1 posts
    Member since:
    Oct 2011

    Posted 29 Sep 2015 Link to this post


    I'm styling page number in the footer section like this:

                var fontSize = 11d;
                var paragraph = new Paragraph();

                var page = new PageField { DisplayMode = FieldDisplayMode.Result };
                var pageStart = new FieldRangeStart { Field = page };
                var pageEnd = new FieldRangeEnd { Start = pageStart };

                paragraph.Inlines.Add(new Span("_") { FontSize = fontSize   // span that is replaced by actual page number with setted font size

    In the silverlight application this page number looks fine, font size is the same as in code.

    Problem occurs when exporting RadDocument to word document. In this scenario font-size of the page number in the footer is altered to 12 (I think it's default value). After exporting to word document, if you try to export to for example pdf, font-size is bugged too. 

    Any ideas how to solve this problem?

  2. Tanya
    Tanya avatar
    883 posts

    Posted 02 Oct 2015 Link to this post

    Hi John,

    The approach you are using actually doesn't always work as expected. I could suggest you to use the RadDocumentEditor class when you make changes in a RadDocument as it provides a better API and performs important updates after the modifications. In the snippet below you could check how I changed the code you sent us to use the mentioned API:
    this.radRichTextBox.Document.Sections.First.Footers.Default.Body = new RadDocument();
    RadDocumentEditor editor = new RadDocumentEditor(this.radRichTextBox.Document.Sections.First.Footers.Default.Body);
    var fontSize = 11d;
    var page = new PageField { DisplayMode = FieldDisplayMode.Result };

    Hope this is helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top