Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Convert HTML to Doc in PHP
Old 03-01-2007, 11:00 PM Convert HTML to Doc in PHP
Skilled Talker

Posts: 72
Trades: 0
I try to use
PHP Code:
header("content-type: application/msword"); 
But it's just allow me to open on msword not save on msword. I test it with Firefox.

So Is it possible to export html format to doc in php? If yes how?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jaketmerah is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-02-2007, 03:50 AM Re: Convert HTML to Doc in PHP
OmuCuSucu's Avatar
Vi Veri Veniversum Vivus

Posts: 1,168
Name: Dragos-Valentin
Location: Cluj-Napoca, RO
Trades: 0
header only tells the browser what kind of file it is, it doesn't convert. as for how to ... i hope someone else can tell you.
__________________
.
» Please remember to add to my Talkupation if you enjoyed my post. Thank you :)
.
OmuCuSucu is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 10:40 AM Re: Convert HTML to Doc in PHP
Ultra Talker

Posts: 483
Trades: 0
Looking at some code I have lying around here, it seems that later versions of Office are capable of accepting HTML formatted code as a DOC file, so long as the appropriate tags are presented at the start of the file.

The code that I'm looking at does the following to tell the browser that you're sending it a Word file:
PHP Code:
header'Pragma: public' );
header'Content-Type: application/msword' );
header'Content-Disposition: attachment; filename="' $the_filename '.doc"' ); 

Then sends the following to tell the Word file to accept HTML:
HTML Code:
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
Then just outputs HTML as normal... hopefully that should work and may get you somewhere!
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 03-04-2007, 10:35 PM Re: Convert HTML to Doc in PHP
Skilled Talker

Posts: 72
Trades: 0
Yup it can work now but it can't save image.
How can I save images when export html to doc?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jaketmerah is offline
Reply With Quote
View Public Profile
 
Old 03-04-2007, 11:01 PM Re: Convert HTML to Doc in PHP
Ultra Talker

Posts: 483
Trades: 0
No idea. Because it has to all be in one file, I'd take a stab in the dark and say that it's some sort of embedded, encoded thing (maybe MIME-like) but I really have no idea. Sorry.
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Convert HTML to Doc in PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28360 seconds with 12 queries