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

Exporting as HTML not working as expected

1 Answer 172 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Justin
Top achievements
Rank 1
Justin asked on 27 Mar 2012, 02:50 PM
Hello,
I am using the Rich Text Editor to construct documents that contain Mail Merge Fields. These documents are then exported as HTML and uploaded to another company that handles the actual mail merge portion or our requirement. All of this used to work as expected until the latest version of the Rich Text editor.

It now appears that the HTML export has change enough that the mail house can no longer perform the required mail merging that we need. The problem lies in embedding style classes or font styles into the document. I need the exported HTML to not include these extra tags. I have investigated the available HtmlExportSettings but haven't yet been able to get the document to come out as I need. 

For example this is the closest I have been able to come:
<span class=\"s_1F6AEA04\">Another email with a Coupon Code: </span><span class=\"s_1F6AEA04\">[</span><span class=\"s_1F6AEA04\">CouponID</span><span class=\"s_1F6AEA04\">:]</span>
The merged field has got to come out as [CouponID:], however each component of that code is wrapped in a span. I have a hunch that it would be fine if the entire field was wrapped in a span, but I can't have it broken up as it is above.

I am using the following settings to achieve this:
HtmlExportSettings settings = new HtmlExportSettings()
            {
                ImageExportMode = ImageExportMode.ImageExportingEvent
            };
 
            settings.ImageExporting += (s, e) =>
            {
                count++;
 
                newFileName = string.Format(imageFileName, count.ToString(), e.Image.Extension);
                newFileNames.Add(newFileName, e.Image.RawData);
                e.Src = newFileName;
                e.Alt = "image";
            };
 
            settings.StylesExportMode = StylesExportMode.Classes;
            settings.ExportFontStylesAsTags = true;
            settings.DocumentExportLevel = DocumentExportLevel.Document;
            settings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
 
            exporter.ExportSettings = settings;


Is there any way to build the HtmlExportSettings so that these span tags are completely removed?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 30 Mar 2012, 02:59 PM
Hi Norm,

I looked through the previous communication and the problem is probably due to the way the brackets are replaced, e.g. "{" and "}" are changed to "[" and "]". However, we were not able to reproduce the issue stably.
Could you attach a sample project to the support ticket you have opened, so that we can look into the cause of the incorrect behavior and suggest a fix?

Looking forward to your reply in the ticket.

Kind regards,
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 >>
Tags
RichTextBox
Asked by
Justin
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or