From: "Jan E." Date: 2012-06-27T19:33:36+09:00 Subject: Re: Copying text from MS Word and wrapping in HTML - help please Hi, What's the exact format of the Word files? It might be easier to parse the original file with all the structure information rather than the extracted plaintext. For example, .docx files are XML and can easily processed with the Nokogiri library. I've actually used it to transform Word documents into simple HTML. In general, you can recognize paragraphs by looking for empty lines (two or more newlines with only space in between). The lists can be converted by starting a new list at the first list entry and closing it at the last one. This requires a more complex logic than you actually use. By the way, you don't have to replace special characters by hand. The Ruby libraries already have methods for this (I don't remember the exact name, but it's probably in CGI). -- Posted via http://www.ruby-forum.com/.