ActiveReports 17 RichTextbox

Posted by: softcomlimited on 26 April 2023, 5:00 am EST

    • Post Options:
    • Link

    Posted 26 April 2023, 5:00 am EST

    I am in the process of upgrading from AR12 to AR16 and then AR17. I use RTF text inserted in RichTextBox at design-time of xml section reports.

    I note in the AR14->15 notes says “Now you can use a Section Report with an ASP.NET Core with GcDoc based rendering.” and the AR17 documentation it says “RtfRenderingType Renders the RTF control with a legacy renderer or with the WordPad as a metafile or raster image. Only the legacy RTF renderer supports fields.

    Are RTF fields not supported in CrossPlatform mode? It does not seem that I can use RTF at design-time. Does “legacy” indicate that you are planning to phase out support RTF and support for fields in RichTextBox ? If so how would one do mail merge in the future?

    Regards

    Brian

  • Posted 26 April 2023, 10:11 pm EST

    Hi Brian,

    >> Are RTF fields not supported in CrossPlatform mode? Does “legacy” indicate that you are planning to phase out support RTF and support for fields in RichTextBox ? If so how would one do mail merge in the future?

    Yes, due to technical limitations, RTF is not supported in CrossPlatform mode and the RichTextBox renders only HTML in CrossPlatform mode.

    It is suggested to convert your RTF to HTML in order to render them in the RichTextBox when using CrossPlatform compatability. You can use third party packages such as https://www.nuget.org/packages/RtfPipe to convert your RTF to HTML and assign it to your RichTextBox.

    Regards,

    Anand

  • Posted 26 April 2023, 11:51 pm EST

    Anand,

    So going forward ASP.NET RichTextBox will not support RTF?

    So what do you suggest we do if we need to continue to enable end-users to create their own xml-rpx (or whatever new format) templates for doing mail merge? In the AR17 documentation (https://www.grapecity.com/activereportsnet/docs/latest/online/create-mail-merge-with-richtextbox.html) it only speaks about using the RichTextBox which then has to use RTF.

    Is it that the RtfPipe is used to convert the RTF to HTML after the fields have been mail-merged? Do you have a case sample?

    We have been using AR RichTextBox in our application for the last 10 years and it is a very simple and elegant solution we don’t really want to have to change to use something else for the next few years.

    Thanks

    Brian

  • Posted 30 April 2023, 2:08 pm EST

    Hi Brian,

    Currently, ActiveReports does not have any of its own packages to render RTF content in SectionReport and the package ActiveReports currently uses to render RTF is not fully supported in CrossPlatform compatibility. However, the support for RTF in CrossPlatform mode is currently under discussion.

    >> Is it that the RtfPipe is used to convert the RTF to HTML after the fields have been mail-merged?

    No, for mail-merged reports the RTF content stays as RTF only it just replaces the Field values from the RTF string.

    However, you can achieve the same with your HTML by introducing a custom variable in your HTML and using the ‘String.Replace()’ method to replace the variable with the desired value within your Section’s Format event handler.

    Please find attached a sample implementing the same.

    Regards,

    Anand

    RTFToHTML.zip

  • Posted 1 May 2023, 12:32 am EST

    Anand,

    I follow you. So it is NOT that you are planning on dropping RTF rendering. For my end-users being able to use the RTF WYSIWIG editor and insert merge fields is the easiest and most elegant solution to create their mail merge letters in my applications. So for the time being we will have to stick to GDI Compatability mode.

    Thanks for the sample. Maybe if you are able to let RichTextBox do HTML WYSIWIG editing it would come close to being as good as RTF.

    Regards

    Brian

  • Posted 1 May 2023, 11:27 am EST

    Anand,

    I’m looking at the sample. One thing I want to make sure that you note, in my case users would have set the RTBox RTF text at design-time, not by loading a file into the RTBox at run-time.

    Brian

  • Posted 1 May 2023, 10:05 pm EST

    Hi Brian,

    To load your RTF at design time you can save your RTF Text as a ‘.rtf’ file and in the designer, you can right-click your RichTextBox and choose the ‘Load File’ option to load your ‘.rtf’ file.

    However, if you want to specify the RTF Text directly to your RTB you can double-click your RichTextBox and paste your RTF Text. As this is going to be read as plain text, as a workaround you’ll need to handle assigning the RTF Text through code behind in the section’s format event as:

    	string RTF = this.RichTextBox1.Text;
    	this.RichTextBox1.Text = String.Empty;
    	this.RichTextBox1.RTF = RTF;	
    

    Please note: If you are working with WebDesigner, specifying the RTF to RichTextBox is not possible, as the WebDesigner does not support RTF in the RichTextBox and you’ll need to set the RTB’s HTML in that case.

    Regards,

    Anand

  • Posted 2 May 2023, 1:57 am EST

    Ok, thanks

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels