Pasting MS Word Content

17 posts by 6 authors in: Forums > CMS Builder
Last Post: May 14, 2008   (RSS)

By InHouse - April 22, 2008 - edited: April 23, 2008

I've looked through this material but can't (yet) find how to strip less-than-helpful code pasted into TinyMCE. I'm thinking that if I can get it to always strip 'class="MsoNormal"' and the rest of the Mso... nonsense then that would make everyone's lives easier.

I found a promising thread but it's beyond my meagre skills at this time of night:
http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=5824

Any thoughts on this?
J.

Re: [InHouse] Inserting a <form> </form>

By Dave - April 22, 2008

Did you try the Paste from Word button? That's the clipboard with the W on it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Inserting a <form> </form>

By InHouse - April 23, 2008

Sure have and it works fairly well. I just know my clients. They'll forget to do that and then get mad that their pasted material doesn't look just like their Word doc - even though they've really fouled up the Word internal styling and that's what's causing the problem.

If I could just get those codes which are not going to be used anyway, out of the picture then life will be easier all around.

We've already created CSS rules for many of the Mso... classes but that does not guarantee proper display.

J.

Re: [InHouse] Inserting a <form> </form>

By Dave - April 23, 2008

Ok, well we're using the tinyMce Paste plugin and it has a number of configurable options. You can see them here: http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste

And you can modify them in lib/menus/default/edit_functions.php (search for "tinyMCE.init").

Enabling 'paste_auto_cleanup_on_paste' automatically cleans on paste in IE and pops up a paste as text box in mozilla.

I'll upgrade tinyMCE for the next release, I see in the changelog they've also fixed the 'paste_use_dialog' to work in IE.

Maybe one of those options would work out well?
Dave Edis - Senior Developer
interactivetools.com

Re: [InHouse] Inserting a <form> </form>

By Codee - April 23, 2008

MsWord code is a huge consistent problem, not just here - but in all html - and there's one easy solution:

1) Open up your doc in Word
2) Open up NotePad
3) Copy (ctrl-a) all your text from Word to your clipboard
4) Paste (ctrl-v) your clipboard to NotePad. this removes MOST Word formatting and special characters, etc.
6) Search and replace all apostrophes and quotes with notepads apostrophes and quotes.
5) Copy (ctrl-a) all you notepad text into your html or php page

That always takes care of this for me

Re: [equinox69] Inserting a <form> </form>

By Jake - April 23, 2008

Hi equinox69,

Thanks for posting those simple instructions - that's a great tip. [:)]
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@interactivetools.com

Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.

Re: [equinox69] Inserting a <form> </form>

By InHouse - April 24, 2008

Quite right equinox69. If I was going to be doing the data entry on this site that would be one of the ways I would approach it.

The problem is that there are clients involved. They would not see these extra steps as reasonable. <sigh>

J.

Re: [InHouse] Inserting a <form> </form>

By Dave - April 24, 2008

Did you give the 'paste_auto_cleanup_on_paste' a try? Are the users mostly on IE? That will clean on paste in IE and pops up a paste as text box in mozilla.

Would that work for the users do you think?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Inserting a <form> </form>

By InHouse - April 25, 2008

Have now tried this. It looks very promising. It does a nice job of removing all the style formatting while, by default, keeping the lists, paras and line breaks. This forces the client to format things like headers and bold type.

I think this is a good starting point. The Paste as Word function does remove the Mso... styles but it leaves normal style calls intact. That's reasonable enough in the hands of capable users of MS Word, but...

Cheers,
Jayme

Re: [InHouse] Inserting a <form> </form>

By Dave - April 25, 2008

I think what I'll do is update to a newer version of tinyMCE and add some options for Word filtering to the Admin > General menu. Watch for that in the next couple releases.
Dave Edis - Senior Developer
interactivetools.com