Jump to content

.doc Files in PHP?


benmajor

Recommended Posts

Hi all,

I wonder if anyone can help. I am currently building a website that requires information currently stored in a Word Document to be shown on a basic web page. Obviously one solution is to enter each piece of information in the Word Document into a MySQL database, and then using PHP to retrieve and format the data. However this is obviously a very monotonous task (especially for a 30 page .doc file). As a result I wondered whether it was possible to have PHP convert the document into a formatted HTML page. So for example if the Word file is formatted with a Header, PHP can convert this to <h1> and so on.

Is this, or anything similar to this a possibility in PHP?

Thanks in adavnce,
Ben
Link to comment
https://forums.phpfreaks.com/topic/30566-doc-files-in-php/
Share on other sites

This might be possible with COM...

http://www.php.net/COM

However, the easiest, and fastest way, would be to use something like Dreamweaver, where you can just copy and paste and it does all the work for you.

Or save the word document as a .html file, then use a utility, such as DW, to clean up all the extra "MS Word" tags that it puts in there to get it back to a semi normal html document.
Link to comment
https://forums.phpfreaks.com/topic/30566-doc-files-in-php/#findComment-140725
Share on other sites

[quote author=fert link=topic=118529.msg484397#msg484397 date=1166051533]
this isn't possible in php due to how word documents are formatted.
[/quote]

According to the code in this post it's possible: http://www.webdeveloper.com/forum/printthread.php?t=23293

Here is a proper download page for the script: http://www.getfreesofts.com/script/456/23079/Convert_MSWord_to_html_on_the_fly.html
Link to comment
https://forums.phpfreaks.com/topic/30566-doc-files-in-php/#findComment-140731
Share on other sites

[quote]this isn't possible in php due to how word documents are formatted.[/quote]

Of course its possible, just not easy. The first thing I would do would be to go over to www.phpclasses.org and see if you can't find a class to help you parse the horible mess that is [i]word[/i].
Link to comment
https://forums.phpfreaks.com/topic/30566-doc-files-in-php/#findComment-140741
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.