Click here to Skip to main content
11,920,156 members (58,513 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

Extended ExtJS HtmlEditor to handle paste from Microsoft Word and table manipulations

, 3 Oct 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Sample regular expression set to filter unwanted Microsoft Word paste tags and characters

ContextKnowledge Center Site
NeedAllow for pages with predefined styles to be added
FeatureSupport a template engine in combination with a set of stylesheets
RequirementImplement an editor for manipulating text, images, and tables without interfering with stylesheets' fonts, colors, alignments, and overall structure.

There are a number of available WYSIWYG editors, such as CKEditor[^] and TinyMCE[^]. However, with their full spectrum of functionality, they are heavy-weight and detract from the predictability of the content layout. While a much simpler tool is required, it seems uneffective to implement one from scratch.

It was decided to use the ExtJS Ext.form.HtmlEditor[^] component as the system already uses the ExtJS framework. But in order for this to work, the component had to be configured correctly and extended to handle:

The copy and paste problem turns out to be a little tricky. There are a lot of bits and pieces of information on the web that, when collected, seemed random (and inconsistent):
JS (Server) removal of MS Word HTML/XML[^]
Cleaning Word's Nasty HTML[^]
MS Word Special Character Scrubber[^]

I ended up refining and splitting the set into tag replacement and character replacement sets that work in the Ext HtmlEditor component (and do not interfere with its tags). Maybe somebody will find this information useful.

See also:
Introduction to Ranges[^]
Intercepting the Clipboard data on Paste[^]


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ilka Guigova
Software Developer
Canada Canada

You may also be interested in...

Comments and Discussions

Generalps. Further reading led me to discover the ExtJS HtmlEditor ... Pin
Ilka Guigova13-Sep-11 20:33
memberIlka Guigova13-Sep-11 20:33 
Generalps.When making an entry at the Ext forum site I used, what I... Pin
Ilka Guigova13-Sep-11 20:32
memberIlka Guigova13-Sep-11 20:32 
General<a href=" Pin
Ilka Guigova13-Sep-11 7:25
memberIlka Guigova13-Sep-11 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151120.1 | Last Updated 3 Oct 2011
Article Copyright 2011 by Ilka Guigova
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid