Log in

View Full Version : Convrt WordFile into HTML Code.



round
04-10-2013, 06:52 AM
Hi,
Do anyone have any idea about converting .doc or .docx file into HTML Code without using COM in PHP ?
Thanks for any help.

FrickenTrevor
04-10-2013, 06:56 AM
File > Save As > HTML Document

round
04-10-2013, 06:59 AM
@FrickenTrevor : Dude i am taking about converting Wordfile into HTML code using PHP.
Anyways thanks for your efforts.

Beverleyh
04-10-2013, 07:45 AM
Are you wanting to just convert/clean the markup generated by MS Word? (to strip out all the extra tags/bumf)
Maybe a function like this?: http://forums.squizsuite.net/index.php?showtopic=11304

Or maybe something here?: http://stackoverflow.com/questions/4587216/how-can-i-convert-a-docx-document-to-html-using-php

djr33
04-10-2013, 08:34 AM
It's going to be a mess. The styling is just different, and whatever happens it won't work out perfectly or be optimal HTML code.

Your best option is to re-create everything in HTML based loosely on the Word document. That's more work, but, well, the formats are just incompatible.


You CAN get a readable webpage from a Word document, but it won't be a good webpage. It depends on your goals.

round
04-10-2013, 08:49 AM
@djr33 : Yes i just need to have the text of the document only. Format doesn't matters in my case.
Anyways thanks.

@Beverleyh : Thanks for your reply, but it doesn't work with my Wamp.
I am getting null value of $index.
Do i need to start any service ?
can you please help me ?

Sorry i am talking about second link (stackoverflow).

djr33
04-10-2013, 09:02 AM
@djr33 : Yes i just need to have the text of the document only. Format doesn't matters in my case.
Anyways thanks.Ok, that's reasonable then.

Do you need .doc and .docx? The latter may be possible using just PHP with an XML parser. The former will need something more specific, specially designed for reading the .doc format.

round
04-10-2013, 09:15 AM
I do need for both.
Actually Customers on my site will upload their doc/docx file. I have to show these files in my CKEditor in backend when they logedin into their account, So that they can chage if they need something to change.

I can not change the concept of uploading doc.docx file, It is on of the requirement of this project. I have to find the way to solve this problem.

By the way i tried with .doc file when it gives null $index. Do you have any solution for this ?

round
04-10-2013, 11:44 AM
I got one solution to get contents from doc/docs file is file_get_contents(). or you can also open file using fopen() then Read file using fread().
Both the methods will gove only texts(Contents), You can not able to get exact structure.!!


[Mod's note: we'll delete spam as we get a chance; the "report" feature will let us know that it's here, but please don't quote it or reply to it, so that when we delete it there's no additional copy or other material that doesn't fit in the thread. In this case I've removed your reply/quote in addition to the spam message itself.]