This is a migrated thread and some comments may be shown as answers.

HTMLTextBox Issue Telerik Reporting Q1 2013 build 7.0.13.220 WPF Report Viewer

3 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 2
Alan asked on 07 Mar 2013, 02:00 PM
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;
        }
    }
}

3 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 11 Mar 2013, 05:57 PM
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.

0
Alan
Top achievements
Rank 2
answered on 13 Mar 2013, 12:50 PM
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;
        }
0
Elian
Telerik team
answered on 15 Mar 2013, 04:44 PM
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.

Tags
General Discussions
Asked by
Alan
Top achievements
Rank 2
Answers by
Elian
Telerik team
Alan
Top achievements
Rank 2
Share this question
or