Export Html Headlines

4 posts, 0 answers
  1. Sebastian
    Sebastian avatar
    9 posts
    Member since:
    Feb 2015

    Posted 17 Jul 2015 Link to this post

    Hi,

    we want to use the RichTextBox-Control for an CMS editor.

    So we want to use it for creating and formatting texts and converting the XAML in HTML via the HtmlFormatProvider.

    ​My question is how I've to design a StyleDefinition so that it will be exportetd as headline tag (h1 h2, ... , h6)?

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 22 Jul 2015 Link to this post

    Hello Sebastian,

    The HtmlExportSettings have an option that will export the built-in Heading styles as h1 to h6 tags. Creating a custom style that will be mapped to those tags is not possible, however, as headings in both HTML and DOCX formats have special meta meaning. 

    That said, my suggestion would be to set the ExportHeadingsAsTags property of the export settings to true and modify the appearance of the Heading styles to correspond to your needs. It's also possible to change the DisplayName of a style, so the name that is visible in the styles gallery will be different. Could you let me know whether this will fit your scenario?

    Regards,
    Petya
    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
  4. Sebastian
    Sebastian avatar
    9 posts
    Member since:
    Feb 2015

    Posted 23 Jul 2015 Link to this post

    Okay thanks,

     is there realy no way to create Heading styles in code?

  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 24 Jul 2015 Link to this post

    Hi Sebastian,

    It's completely possible to create a custom style definition with the same characteristics, i.e. a linked style that is shown in the gallery and will be included as an entry when generating a table of contents, and so on. Mapping it to <h1> when exporting to HTML, however, is not possible.

    I could log a feature request for this, but am unsure of the scenario that it is needed for.  As a mentioned in my previous reply, those are simply styles with special meta meaning. In fact, I tried creating a custom style in MS Word with the mentioned settings and exporting to HTML just to see if the style will be mapped to a heading in the HTML document, and it doesn't appear to work in that way.

    Is modifying the default Heading styles not a feasible option for you? If you could provide a bit more details on the exact needs of your application and the reason you're looking for such customization option, I'll consult with the development team and we will try to propose the best option for you.

    Regards,
    Petya
    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
Back to Top