Style Colors with DocxFormatProvider

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    2 posts
    Member since:
    Apr 2013

    Posted 24 Nov 2015 Link to this post

    Hi!

    The DocxFormatProvider resets any Color informations of any Styles to the default light blue when I export with it.

     I export like this:

    DocumentFormatProviderBase format = null;
     
    format = new DocxFormatProvider();
     
    format.Export(radRichTextBox.Document, File.Open(filename, FileMode.Create));

    I used versions 2015.3.1104.45, 2015.3.1104.40 and 2015.3.930.40

    Did i miss some setting or, if not, is there any workaround?

    It works fine with the htmlformatprovider, but i need the header and footer, which is cut off by it.

     

     


     
     
     
     
     
     
  2. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 26 Nov 2015 Link to this post

    Hello Thomas,

    Indeed, this is an issue in the DocxFormatProvider related to  the priority of the different colors, set to the style. In this case, the theme color, which is with higher priority, is not cleared from the style and takes advantage when the document is visualized.

    I logged the issue in our bug tracking system and you could subscribe to the related public item in order to receive updates about status changes on it. Your Telerik points are updated as a token of appreciation for this report.

    To work around this, you could set the forecolor of the style in the code-behind:
    StyleDefinition style = this.radRichTextBox.Document.StyleRepository["Heading1"];
    style.SpanProperties.ForeColor = Colors.Red;
     
    StyleDefinition styleChar = this.radRichTextBox.Document.StyleRepository["Heading1Char"];
    styleChar.SpanProperties.ForeColor = Colors.Red;

    Hope this helps.

    Regards,
    Tanya
    Telerik
    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top