Anyone know the best way to convert HTML to Word / PDF /Excel ? I wrote a module to use Stellent in Drupal to mass convert all my Microsoft Word / Excel / PDF docs into HTML (while retaining images, storing them on the server.) Works like a charm!

HOWEVER, converting HTML (with images) to Microsoft Word / Excel / PDF is proving to be much more difficult.

I can't just do a 'Save As Doc' from HTML because the image links become broken. Doesn't Word embed images as bitmaps?

Is there any utility out there that does this?

thanks!
-bg

Comments

bradleyg’s picture

found a great php class on the PHP Classes site HTMLtoWord.

works great!

TSE’s picture

Hi,
i know this thread is old but since i've found no module to convert Drupals output to word, i wonder how i can use the above mentioned class to do this ?

i think the link to this class might be http://memory-page.net/blueshoes/documentation/phpdocu/blueshoes-4.5/cor...

Can anyone tell me how to use it ?

TSE

Anonymous’s picture

I'm just not getting it working in drupal.
Can You please please say how you did this step by step?

Anonymous’s picture

I found a little bit more information about it:

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/msword";
string strFileName = "GenerateDocumentfgfgfg" + ".doc";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName);
StringBuilder strHTMLContent = new StringBuilder();
strHTMLContent.Append(RadEditor1.Content);
-- RadEditor1.Content is HTML Text I m taking it from editor.

HttpContext.Current.Response.Write(strHTMLContent);
HttpContext.Current.Response.End();
HttpContext.Current.Response.Flush();

If I can figure out how to implement this I will also public it.

Timna’s picture

Hi bradleyg,

I note your comment that you "wrote a module to use Stellent in Drupal to mass convert all my Microsoft Word / Excel / PDF docs into HTML (while retaining images, storing them on the server.) Works like a charm!"

I am interested in finding out more about this. Please note I am not an IT person, but someone who is involved in managing the upload of a large amount of Word documents (and a few excel and pdf) (all within inter-document hyperlinks, figures/images and specific styles/formatting that must be preserved). I say this so that any responses will be 'dumbed down' for a layperson like me!

Is there an add-on to the Drupal system that is able to be used for this?

Thanks
Timna