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....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| generally we are exporting excel or csv file, here i want to do the same process in ms word document. |
|
#2
| |||
| |||
| 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.................... |
|
#3
| |||
| |||
| 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 |
|
#4
| |||
| |||
| 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 |
|
#5
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |
Our Partners |