Sanely Moving from Word to the Web? 547
FooAtWFU asks: "I have a job for a web site (no link for you, Slashdot hordes!). A lot of it is systems administration and development, but I have to routinely post content which comes from a myriad of other sources. Usually they are from academic users, come in Word format, and ultimately need to be posted in HTML. The problem is that Word has all sorts of tricks up its sleeve to throw off the font, layout, size, and so forth. To achieve any sort of visual consistency on the site these various formatting tags all need to be scrubbed, but even using other office suites with better HTML export (OpenOffice.Org) to do the dirty work, it's often easier to recreate the formatting by hand from a plain-text version than it is to clean up a sea of messy tags. Does anyone have any advice (or magical tools) to help me deal with this sort of tedious cleanup?"
Use antiword (Score:2, Informative)
Dreamweaver (Score:5, Informative)
Antiword (Score:3, Informative)
Textism (Score:5, Informative)
http://textism.com/wordcleaner/ [textism.com]
I used it once and it did a pretty decent job at preserving the tables. Yet if they're using anything odd like graphics or it's been incredibly tweaked, it probably won't be 100% perfect.
HTML Export (Score:3, Informative)
http://www.microsoft.com/downloads/details.aspx?F
I believe this functionality is built into later versions of Word.
Per the site, this produces simpler HTML with Office-specific tags removed. With that done, you could probably use a PERL script, and you might also try writing some Word macros or COM/VBA scripts that clean up the document from within Word.
Dreamweaver (Score:5, Informative)
Good luck!
HTML Tidy (Score:5, Informative)
Re:Dreamweaver (Score:5, Informative)
no link for you, Slashdot hordes! (Score:5, Informative)
Step 1: Let's look at his user page [slashdot.org]
Ahh! He put in a website with his profile. Let's all go and check out http://fennec.homedns.org/ [homedns.org]
Hmm... looks like a personal page. Not too sure what to make of the comic. Anyway, let's move on to..
Step 2: Let's look at his author [wfu.edu] page. Some interesting stuff here, including three separate e-mail addresses (which I won't post here. You're welcome
A-ha! There is a link to his employer! It's Economic History Services [eh.net]. And what do you know... there are a significant number of pages (especially under abstracts and book reviews) that seem to come straight out of a word processor, only with extensive cleaning. A quick look at the source reveals something interesting. It's clean. Very clean. We're talking on the level of I-use-vim-for-my-webpage-editor clean. Nice job.
Anyway, it looks like it was done by hand. I'm not saying its not good work (quite to the contrary), but I can see your need for an automated solution.
Re:Handy alternative to Notepad (Score:1, Informative)
HTML Tidy (Score:3, Informative)
HTML Tidy has a special mode for cleaning up Word's crappy HTML export. HTML Tidy is a free command-line tool that is also embedded in a lot of popular HTML editors.
HTML Tidy:
http://tidy.sourceforge.net/ [sourceforge.net]
HTML Kit (great integration with HTML Tidy; it includes HTML Tidy so you can just grab HTML Kit without grabbing HTML Tidy)
http://www.chami.com/html-kit/ [chami.com]
Countless other editors integrate with HTML Tidy as well. Have fun and good luck!
Tidy Flags (Score:5, Informative)
Convert to PDF (Score:1, Informative)
Many free or cheap printing filters / converters available
Beautiful Soup (Score:1, Informative)
P.S. There is a Ruby Port [crummy.com] as well.
Re:Textism (Score:4, Informative)
Re:HTML Export (Score:5, Informative)
fckeditor (Score:3, Informative)
The interface is similar to Word - maybe if you're lucky, you could get some of your content producers to use it.
HTML Tidy program (Score:5, Informative)
One program I've had luck with is the HTML Tidy program at http://www.w3.org/People/Raggett/tidy/ [w3.org]. It seems to clean up code (particularly from Word) quite a bit.
WordML - FO - XHTML/PDF (Score:5, Informative)
Using a modern version of Word, output in WordML (xml format). Use a XSL stylesheet [antennahouse.com] to convert the WordML to FO (formatting objects).
From there, do anything you want, like XHTML or PDF.
Or just go to XHTML from WordML with some stylesheet. XSL is teh cool!
Net-It is your magical tool (Score:4, Informative)
Oh, you mean non-commercial magical tools?
Re:Dreamweaver (Score:3, Informative)
Worked pretty well, once I'd got the search/replace stuff sussed out.
Mind you, on a big word file you can think it's crashed when actually it's just doing lots of thinking...
Re:Scrapping (Score:3, Informative)
Re:Tidy Flags (Score:2, Informative)
Why? XHTML isn't any better than HTML 4.01 for almost anybody, and it's less compatible.
Pagify (Score:3, Informative)
Try this.... (Score:5, Informative)
Demoroniser is, in the author's own man pages words:
A Perl script which corrects incompatible HTML generated by Microsoft applications. [fourmilab.ch]
You can get it from the link in the same page. I must confess that I've not used it myself (don't use Office/Frontpage) but if it does what it says on the tin it should sort you out.
Re:Use antiword (Score:3, Informative)
Dreamweaver MX 2004 (Score:3, Informative)
2) Select All -> Copy
3) Open Dreamweaver
4) File -> New Html Doc
5) Paste
6) Commands -> Clean up Word Html
7) Commands -> Apply Source Formatting (if you take the time to set the programs preferences to what you like)
8) Done
9) Drink beer
10) Sleep
Re:DEMORONISER (Score:3, Informative)
The Unmoroniser is an updated version that handles Unicode properly and will do things like convert proprietary Windows-only curly quotes to the appropriate HTML4 entities instead of dropping them back to less accurate, typographically offensive straight quotes. Same with ligatures and other characters that the Demoronizer would munge instead of convert.
http://rheme.net/unmoroniser/ [rheme.net]
Re:no link for you, Slashdot hordes! (Score:4, Informative)
Re:PDF? (Score:3, Informative)
Re:Export it as XML and XSLT it to HTML (Score:3, Informative)
1) get a copy of Word 2003
2) "save as" an exemplar as XML
3) write an XSLT to render it in a HTML with stylesheets etc as appropriate to your website
4) for every document you get, "save as" XML with the XSLT from 3) as the transformation.
5) publish
I've been wondering how long until using XSLT and XML was suggested. XML is supposed to be a common data transport format but most of the other comments talk about starting with tranformations to Word HTML. This is wrong because it assumes that the Word to HTML conversion will produce usable HTML in the first place which is a bad assumption.
The solution suggested by the AC could be combined into a program that drives the entire process using the Word COM API to save to XML and then then, for example, the MS Jet XSLT COM object model to automate the XML conversion. This could easily be maintained (eg: new Word formatting not previously encountered) with small changes to the XSLT.
If the desire is to completely control the output without having control of the input then this is the best way to go. Yes, it's a bit of work but once you have a maintainable turn-key system you will save a lot of futzing with manual formatting. Use the power of XSLT.
Re:Dreamweaver (Score:5, Informative)
If you paste text into the Code view, DW removes the formatting completely and just uses the raw text.
Re:Textism (Score:2, Informative)
Textism looked pretty cool, so I tried it out with a typical .htm export (67K). However, it requires a subscription (Paypal payment) to process files larger than 20K. In my experience many .htm files pumped out by MS Office are larger than 20K, so I imagine the submitter may want to look elsewhere...
With that said, if the people that have assigned the submitter with the web work want their employee to have the tools they need to do quality web work, they should pay for quality tools so the submitter can get the job done.
Side note: The Dreamweaver "Command..." option suggested below just worked great on the same file.
Re:Dreamweaver (Score:2, Informative)
Re:Dreamweaver (Score:1, Informative)
I have DW MX on a PC and it doesn't do the table copying and pasting from Word.
On my Mac I can copy tables from Word and paste them in to DW MX 2004 and they'll drop in nicely, minus all the funky Word stuff. DW will also attempt to keep logical formatting in good HTML. Which is nice.
Alternatively, depending on the complexity of the Word docs, consider saving them all out as plain text and then going back to format correctly. If yu have many tables and images this could be a pain, but if you have reams of text it may be much quicker.
RTF (Score:2, Informative)
Using that process has made preserving italics, bold, and special characters much easier for me and almost seems fully automatable.
I've been using this method recently with some very simple search and replace and able to get good results.
Re:Handy alternative to Notepad (Score:2, Informative)
works for me anyway..
- paul
Re:More specifically: Word into MS CMS (Score:3, Informative)
You can also add an event handler for the updating event that does some regex tidying. Replacing the regex "]*>" will go a long way (better double-check that). You should be able to come up with a similar one for all the smarttag nonsense that gets inserted, too.
Still, Word formatting remains a major bane to my existence. Good luck.
Re:Dreamweaver (Score:2, Informative)
We do this where I work. My job involves taking hundreds of word documents from professors and formatting them for online coursework at a major university in florida. Dreamweaver has made my life so much easier.
Re:Textism (Score:3, Informative)
HTML Tidy cleans Word HTML. (Score:3, Informative)
HTML Tidy cleans HTML, and has a special function for cleaning Word HTML junk.
It must be terrible to work at Microsoft and always do mediocre work.
--
If you support dishonesty and violence [doonesbury.com], don't say you are Christian.
Try PureText (Score:1, Informative)
wvHtml (Score:3, Informative)
From the sourceforge page:
I'm using this to convert all of our internal documentation. It does a pretty good job, even converts the images and acts in a relatively reliable manner with 2003, 2000, & 97 formatted files. There's some oddball output sprinkled in, but nothing a little sed fanciness can't fix.