Hi,
We've been facing some problems with our application because the Clean Word Formatting does not clean style and class attributes.
Here you can see a piece of html before cleaning:
<P style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%"><FONT face=Calibri><B style="mso-bidi-font-weight: normal"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></B></FONT></SPAN></P> <P style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 12pt; LINE-HEIGHT: 115%"><FONT face=Calibri>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in arcu neque, <B style="mso-bidi-font-weight: normal">quis ornare mauris</B>.<o:p></o:p></FONT></SPAN></P>
And after cleaning:
<p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; mso-add-space: auto; mso-list: l0 level1 lfo1;" class="MsoListParagraphCxSpFirst"> <font face="Calibri"><b style="mso-bidi-font-weight: normal;"></b></font></p> <p style="margin: 0in 0in 10pt;" class="MsoNormal"> <font face="Calibri">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in arcu neque, <b style="mso-bidi-font-weight: normal;">quis ornare mauris</b>.</font></p>
Is there any way to get a cleaner code?
We noticed that the code is cleaner when using FireFox or Chrome. Here the code after cleaning in FireFox:
<p> <font face="Calibri"><b style="mso-bidi-font-weight: normal"><!--?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /--></b></font></p> <p> <font face="Calibri">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in arcu neque, <b style="mso-bidi-font-weight: normal">quis ornare mauris</b>.</font></p>
Thanks,
Alejandro
Hello Alejandro,This property is used to remove all the tags inserted while pasting from word. Each browser may have interpret copy-from-Word differently and use different tags. WebHtmlEditor can do nothing about that. That is not only one difference between IE and standard browsers. For example, while doing font formatting (execCommand) the IE inserts <font>, but the two webkit browsers – FF and Chrome insert </span>. If you want to clear more tags you should do it manually.
Hello,Please let me know if you have any further questions regarding this issue.
I understand that the html code generated by the browser when pasting from Word is different, but I would've expected the same quality of cleaning when pressing the "Clean Word Formatting" button.
Right now
Thanks
Hello Alex,
I have been looking into your question and I can suggest you check the following forum thread which discuss how you can get the plain text (without any formatting) through js:
http://ko.infragistics.com/community/forums/p/9356/36438.aspx
If you have any additional questions on this matter please feel free to ask.
I am using Infragistics WebHtmlEditor for entering rich text on one of our website. It has a button "Clean word" that removes unnecessary word formatting. My question is, can this be called without user clicking on it.
The users on my website, do not realize to click this and copy/paste from Microsoft word. I want to do something in the code so it cleans word formatting.
Your help is appreciated.