HTMLTextBox Issue Telerik Reporting Q1 2013 build 7.0.13.220 WPF Report Viewer

4 posts, 0 answers
  1. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 07 Mar 2013 Link to this post

    I am having an issue using the latest (internal) build with the the Reporting control HTMLTextBox.

    When I use a HTML fragment like <u>Test</u> the control renders as expected with an underline. Attached is screen shot HTMLFragment.

    But when I supply the HTMLTextBox well formed HTML like:
    <p style="margin-top: 0px;margin-bottom: 12px;line-height: 1.15;"><span style="font-family: 'Verdana';font-size: 16px;"><u>Test</u></span></p>

    The underline and last letter is missing does not render as in the attached screen shot HTML.

    Any ideas on how I can overcome this?

    XAML
    <Window     x:Class="ReportViewer.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:tr="http://schemas.telerik.com/wpf"
                Loaded="WindowLoaded"
                Title="MainWindow">
        
        <StackPanel Orientation="Vertical">

            <tr:ReportViewer    x:Name="rvWorks"
                                Margin="5 5 5 5" />

            <tr:ReportViewer    x:Name="rvDoesNotWorks"
                                Margin="5 5 5 5" />

        </StackPanel>
    </Window>

    C#
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }

            private void WindowLoaded(object sender, RoutedEventArgs e)
            {
                UriReportSource works = new UriReportSource();
                UriReportSource doesNotWork = new UriReportSource();

                works.Uri = @"C:\Temp\HtmlTextBox.trdx";
                works.Parameters.Add(new Telerik.Reporting.Parameter("htmlTextBoxValue", "<u>Works</u>"));

                doesNotWork.Uri = @"C:\Temp\HtmlTextBox.trdx";
                doesNotWork.Parameters.Add(new Telerik.Reporting.Parameter("htmlTextBoxValue", @"<span style=""font-family: 'Verdana';font-size: 6px;""><u>Does Not Work</u></span>"));
                
                this.rvWorks.ReportSource = works;
                this.rvDoesNotWorks.ReportSource = doesNotWork;
            }
        }
    }
  2. Elian
    Admin
    Elian avatar
    435 posts

    Posted 11 Mar 2013 Link to this post

    Hello Alan,

    We weren't able to reproduce the problem with the provided description. It would be best if you open a support ticket and attach a sample runnable project there, so we can review it locally.

    One thing you can try is to change the size of the HtmlTextBox item at design-time (try to make it larger and see if there is a change).

    Note: 'margin' and 'line-height' are not supported by the HtmlTextBox. A list of supported tags can be found here
     

    Regards,
    Elian
    the Telerik team

    Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

  3. DevCraft banner
  4. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 13 Mar 2013 Link to this post

    Elian ~

    The HTML tags you wrote about being unsupported are being generated from Telerik's HtmlFormatProvider (which the inbound object RadDocument is coming from Telerik's RadRichTextBox) using the code below.

    What would be the best practice to handle this workflow from one Telerik object (HtmlFormatProvider) to another Telerik object (Reporting HtmlTextBox)?

    Thank you,
    Alan

    Here is the code that handles HtmlFormatProvider in C#:
         private string exportToHtml(RadDocument radDocument)
            {
                HtmlFormatProvider htmlFormatProvider = new HtmlFormatProvider();
                HtmlExportSettings htmlExportSettings = new HtmlExportSettings();
                htmlExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
                htmlExportSettings.StylesExportMode = StylesExportMode.Inline;
                htmlExportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
                htmlExportSettings.ExportFontStylesAsTags = true;
                htmlFormatProvider.ExportSettings = htmlExportSettings;
                string content = htmlFormatProvider.Export(radDocument);
                return content;
            }
  5. Elian
    Admin
    Elian avatar
    435 posts

    Posted 15 Mar 2013 Link to this post

    Hi Alan, 

    The purpose of the HtmlTextBox is to give basic text formatting options and not to support fully capable HTML markup. At the same time the RadRichTextBox export gives you a markup fully representing the text formatting as seen in the control and uses attributes which are not supported by the HtmlTextBox
    The configuration that you are using currently gives the best compatibility between these two controls that you can get.

    Regards,
    Elian
    the Telerik team

    Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

Back to Top