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

RadEditor Content/Format gets corrupted on submit

4 Answers 166 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jacques Mostert
Top achievements
Rank 1
Jacques Mostert asked on 01 Sep 2009, 01:34 PM

Hi there,

I'm using the RadEditor to submit documents via cut and paste method from MS Word and other RichText editors; However, the formatting gets corrupted on paste. Its as if the RadEditor doesn't pickup the fonts I'm using in some of the documents, and with some documents even the Bulleted Lists don't display like they should in the MS Word document.

How do I prevent the RadEditor from doing any sort of formatting on the content. I want the documents to be as they are when copied and pasted into the RadEditor.


I have disabled any sort of formatting or stripping that is obvious and built into the properties that I could find on the surface of the RadEditor control.


Please give me a hand, I would love to get to the bottom of this issue as soon as humanly possible. (unless you have a faster method)

4 Answers, 1 is accepted

Sort by
0
Jacques Mostert
Top achievements
Rank 1
answered on 03 Sep 2009, 01:33 PM
Hi there

Does anyone have an answer to this sort of RadEditor behaviour ?

To reproduce the same error:


1. Open a document in Microsoft Word.
2. Copy document contents to RadEditor.
3. Submit document; Send document via System.Net.Mail.SmtpClient server-side object as HTML email.

4. Receive HTML email.
5. Opening HTML email; Result = Not formatted as previously pasted from word document.


How do I prevent RadEditor from removing any formatting from the pasted document and what happens to the formatting of the document if certain fonts are not available on the destination computer.

Any help would be greatly appreciated.


0
Accepted
Rumen
Telerik team
answered on 04 Sep 2009, 06:58 AM
Hi Jacques,

Let me provide you with details what is happening when pasting content with bullets from MS Word 2007. The paste process is controlled entirely by the Operating System and by the browser. The editor is not allowed to interfere in this process much (of course there are some minor differences between browsers). Thus, with respect to pasting - the original MS Word formatting is not HTML. It is MS Word specific XML formatting. When this is exported to the clipboard, and is made available for paste, it "announces" what "paste flavors" it supports - and those would be MS Word, HTML, Plain text, RTF and so on.
When a client entity (such as the editor) wants to consume the content of the clipboard, it announces what paste formats it supports (and the editor - any editor - only supports plain text and HTML). So, MS Word converts the original MS Word to HTML, and this process is controlled entirely by MS Word, and not at all possible to interfere by the editor.

Office 2003 exports lists to HTML using <UL> tags (which is the proper and expected way), however Office 2007 exports those using P and SPAN tags and the bullet shape is represented by a . dot symbol (which is a strange decision, but the editor has nothing to do with it).

The Paste from Word feature of RadEditor just strips the MS Word specific formatting tags, styles and mso attributes, but it does not modify the content and replacing tags with other tags.

Unfortunately, it is not possible to change this behavior. You will get this behavior with our competitors' editors as well as with any other web-based editor you decide to try.

Regarding the missing formatting when receiving the e-mails: Please, disable the built-in content filters of RadEditor as well as set StripFormattingOptions="noneSupressCleanMessage" to make sure that the content pasted in RadEditor will be not modified by the editor:

<telerik:radeditor runat="server" ID="RadEditor1" ContentFilters="none" StripFormattingOptions="noneSupressCleanMessage"></telerik:radeditor>

and after that check on the server with the debugger the value of the RadEditor1.Content property and compare it with the content of the received e-mail.  If the contents are different then it is the browser that modifies the Word content.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jacques Mostert
Top achievements
Rank 1
answered on 04 Sep 2009, 08:02 AM
Dear Rumen

I thank you very much for replying to my post, it was worth the wait.

One question that remained semi- un-answered though;
"...what happens to the formatting of the document if certain fonts are not available on the destination computer...?"

To clarify this question;
"If the receiving computer does not have the fonts that were used in the orignal MS Word document copied to the clipboard and sent from the client machine..would it try to use a default or system font instead..?" This question might not be Telerik related, however though I would love an answer from any Microsoft Outlook/Incredi-Mail guru that knows what Microsoft does with a document if the font doesn't exist on the receiving machine/computer.


Thanks Rumen, you have been a great help!


Kind Regards,
Jacques.
0
Accepted
Martin
Telerik team
answered on 04 Sep 2009, 08:57 AM
Hi Jacques Mostert,

One of the main principles in web-development is to refrain from using exotic fonts on webpages, because if the font that is set for a certain element is not present on the visitor's machine, the mechanism of the CSS will look for the next font, that is specified in the font-family property, i.e:

div
{
    font-family: "My Exotic Font", Arial, Sans-serif;
}


A long time ago, Internet Explorer (I believe it was in version 5.0) was the first browser that implemented the CSS @font-face: url(font.eot) directive that allowed developers to upload their exotic fonts onto the server, so when the page is visited from a machine that did not have that font, IE automatically downloads and loaded the .eot font and everyone is happy - the page loaded as expected. However, not any font type can be used that way - Microsoft introduced a special tool named WEFT3 (http://www.microsoft.com/typography/web/embedding/weft3/) that convertes .ttf fonts to .eot fonts that can be loaded via CSS. Embedded OpenType is a proprietary standard supported exclusively by Internet Explorer but was submitted to the W3C in 2007 as part of CSS3, which was rejected and resubmitted as a standalone submission. Later on (actually this year, FireFox implemented this functionality in one of their minor releases, but quickly removed it in the next version, because the implementation was buggy). As far as I know, the @font-face will be re-released with FireFox 3.6.

As a bottom line - although this sounds great, I do not recommend to use this approach, because it is not fully supported by all browsers. Again - it is recommended to stick to the basic font principle in web-development - use system fonts...

Arial, Verdana, Times New Roman, "Trebuchet MS", "Segoe UI", "Courier New", Courier, Impact, Georgia, Garamond, System, Serif and Sans-serif.

... because we are still far and away from fully making use of all the magic of CSS.

However, you may take a look at sIFR. I believe you will like Mike's really elegant approach approach to use exotic fonts on a page:

http://www.mikeindustries.com/blog/sifr/



Greetings,
Martin Ivanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Jacques Mostert
Top achievements
Rank 1
Answers by
Jacques Mostert
Top achievements
Rank 1
Rumen
Telerik team
Martin
Telerik team
Share this question
or