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

Q1 2012:Export the document in HTML that is compatible with HtmlTextBox from Reporting

5 Answers 115 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Uwe
Top achievements
Rank 1
Uwe asked on 07 Mar 2012, 05:09 PM
"Export the document in HTML that is compatible with HtmlTextBox from Reporting" is listed as "NEW" in ReleaseNotes Q1 2012.

How can i use this new feature?   Witch settings are right? 

This settings doesn't work!
 
telerikDocs.FormatProviders.Html.HtmlFormatProvider htmlFormatProvider = new telerikDocs.FormatProviders.Html.HtmlFormatProvider();
telerikDocs.FormatProviders.Html.HtmlExportSettings htmlExportSettings = new telerikDocs.FormatProviders.Html.HtmlExportSettings();
htmlExportSettings.StylesExportMode = telerikDocs.FormatProviders.Html.StylesExportMode.Inline;
htmlExportSettings.ExportFontStylesAsTags = true; 
htmlExportSettings.DocumentExportLevel = telerikDocs.FormatProviders.Html.DocumentExportLevel.Fragment;
htmlFormatProvider.ExportSettings = htmlExportSettings;
string html = htmlFormatProvider.Export(richTextBox.Document);

 

5 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 09 Mar 2012, 12:57 PM
Hello Uwe,

We have introduced styles exporting in HTML, so what you see is probably the style repository being written as CSS styles. In order to be compatible with the HTML input that HtmlTextBox recognizes, the document must not include these classes. In order to do that, you have to set one other property as well:

htmlExportSettings.StyleRepositoryExportMode = telerikDocs.FormatProviders.Html.StyleRepositoryExportMode.DontExportStyles;

I hope this helps.

Greetings,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Uwe
Top achievements
Rank 1
answered on 14 Mar 2012, 10:17 AM
Hi Iva,

thank you for your fast answer.

Yes it works, now i put the content from the RTF-Control directly in the value of the HtmlTextBox im my report.
But the content in the HtmlTextBox doen't look like the content in the RTF-Control. Is there no way to transfer the style.

Here is a sample of HTML-Code from the RTF-Control. If i put it in a HTML-File and open it with a browser it looks like the content in the RTF-Control.

<p style="text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;text-indent: 0px;line-height: 1.14583333333333;text-align: left;"><span style="font-family: 'Arial';font-style: Normal;font-weight: bold;font-size: 14.6666666666667px;color: #000000;">Top-Performance mit garantierten CPU- und RAM-Ressourcen</span></p><p style="text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;text-indent: 0px;line-height: 1.14583333333333;text-align: left;"><span style="font-family: 'Trebuchet MS';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">&nbsp;</span></p><p style="text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;text-indent: 0px;line-height: 1.14583333333333;text-align: left;"><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">Virtual Server 4.0: Die Power-Revolution mit bis zu 8 GB garantiertem RAM und bis zu </span><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">6 GHz </span><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">garantierter CPU-Leistung! Ideal für jeden professionellen </span><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">Einsatz, </span><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">bei dem maximale Flexibilität und Performance gefragt ist! Wahlweise mit vollem System-Zugriff oder einfacher Bedienoberfläche mit einem Betriebssystem, das von Host Europe gemanagt wird.</span></p><p style="text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;text-indent: 0px;line-height: 1.14583333333333;text-align: left;"><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">Darüber hinaus profitieren Sie von einer Traffic-Flatrate mit klar definierten </span><span style="font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 14.6666666666667px;color: #000000;">Leistungsgarantien.</span><span style="font-family: 'Trebuchet MS';font-style: Normal;font-weight: normal;font-size: 11px;color: #000000;" /></p>

Greetings Uwe
0
Mihail
Telerik team
answered on 20 Mar 2012, 05:51 PM
Hi Uwe,

Unfortunately there are some limitations in Telerik Reporting related to HTML tags and CSS attributes that are supported. You can read more about them here.

However, provided that you have set all properties of the HtmlExportSettings listed below, the exported document should look quite close to the original one. Please find attached a demo which we used for testing and which has led us to believe that everything works as expected. If you notice some issues, do not hesitate to contact us again.

Regards,
Mihail
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Gene
Top achievements
Rank 1
answered on 23 Apr 2012, 06:35 PM
I've also run into this issue after upgrading.  Prior to updating to Q1 2012, all standard text-formatting tags(bold, italic, etc.) worked in the HtmlTextbox when exported from RadRichTextbox.  After updating, even when following your example, such tags are not exported in a manner that can be displayed by the HtmlTextbox(however, hard-coded HTML does display properly in the HtmlTextbox, telling me the problem is in fact with the FormatProvider).

Our client was pleased with the level of formatting possible with the solution before, but this will not be acceptable.  I can't simply roll back the HtmlFormatProvider to the previous version as RadRichTextbox depends on the newer library.  Will this be addressed and is there a workaround?
0
Mihail
Telerik team
answered on 25 Apr 2012, 11:36 AM
Hi Gene,

Unfortunately we couldn't reproduce the described issue. Could you create a simple document in the editor, which illustrates the issue when exported to HTML and used in Telerik Reporting. After creating such a document, export it to XAML and attach it to a support ticket so we can investigate further this issue.

Looking forward to your reply.

Greetings,
Mihail
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Uwe
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Uwe
Top achievements
Rank 1
Mihail
Telerik team
Gene
Top achievements
Rank 1
Share this question
or