IT Community - Software Programming, Web Development and Technical Support

export to word file using PHP?

This is a discussion on export to word file using PHP? within the PHP Programming forums, part of the Web Development category; generally we are exporting excel or csv file, here i want to do the same process in ms word document....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 08-17-2007, 11:20 PM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post export to word file using PHP?

generally we are exporting excel or csv file,
here i want to do the same process in ms word document.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-18-2007, 03:47 AM
saravanan saravanan is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Posts: 180
saravanan is on a distinguished road
Default Re: how can export to word file using PHP?

hai it is very simple please run these simple program
In the test.php type these coding
<a href="export.php">click here</a>
and save it after open the new page and save the file name as export.php
in the export.php file type this coding
<?php
$vExcelFileName="export". ".doc";
header("Content-type: application/x-ms-download"); //#-- build header to download the excel file
header("Content-Disposition: attachment; filename=$vExcelFileName");
header('Cache-Control: public');
echo "hai";
?>

so if u click the (click here) link in test.php means one window will open for open or saving the document file.
in the document file with the words (hai).


if u need to expotr the details to excel sheet means change the extension
for example
$vExcelFileName="export". ".xls";

thank u....................
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 02-09-2009, 05:03 AM
gseller_jim gseller_jim is offline
D-Web Trainee
 
Join Date: Feb 2009
Posts: 1
gseller_jim is on a distinguished road
Default Re: export to word file using PHP?

Sorry for hitting an old comment but this is fascinating!! Can you please elaborate and share some code on how this is done? I could not make your example work getting "Warning: Cannot modify header information " for each of your header references.. Thank You
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 03-30-2009, 07:45 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: how can export to word file using PHP?

HI,
Just make sure that your page does not have any values printed before to execute the above example and use ob_clean before you are calling this header definition
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 04-24-2009, 05:26 AM
sychurn sychurn is offline
D-Web Trainee
 
Join Date: Apr 2009
Posts: 2
sychurn is on a distinguished road
Exclamation Re: export to word file using PHP?

Hi,

I have tried your codes
<?php
$vExcelFileName="export". ".doc";
header("Content-type: application/x-ms-download"); //#-- build header to download the excel file
header("Content-Disposition: attachment; filename=$vExcelFileName");
header('Cache-Control: public');
echo "hai";
?>

How can I make to have the echo "hai"; to be like a dynamic one. Say I have a form in my other page then I post some data in the form. And when I click on the save button and set the action to your export.php then the data in my forms will be the one to be exported to a word file.

Please help I badly needed to make this work. Thanks in advance
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export table values into excel oxygen C# Programming 2 03-18-2008 01:13 AM
Export Lightroom Plugin kingmaker C# Programming 3 11-29-2007 05:41 AM
How do we import or export data in MySql Jeyaseelansarc Database Support 8 08-17-2007 06:25 AM
How can we import and export using BCP utility in SQL? oxygen Database Support 1 07-26-2007 03:33 AM
How to convert a word document/text document/PDF file into an image file? kingmaker C# Programming 0 07-16-2007 10:23 PM


All times are GMT -7. The time now is 06:19 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0