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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.