informBank

The domain name informbank.com is for sale
I'm not able to support this website any longer, so if you are interested in buying the domain name, click here.

Categories
Health Care
Opinions
Football (Soccer)
Fitness
World Companies
Technology
Space
Faith
Sport
Interesting Facts
Movie Characters
Science
Gadgets
Home Improvement


Search
Search

The Web
This Site





Feeds
RSS Feed
ATOM Feed

Add to Google
Add to MyMSN
Add to MyYahoo
Add to Bloglines
Add to Newsgator
Add to NewsIsFree
Add to Rojo
Add to Kinja
Add to Pluck

How to create Microsoft Office documents on the fly using PHP

Using COM and alternative methods to generate MS Office files (DOC, XLS, PPT) with PHP

Publisher:JohnLocke
Category:Technology
Date:07 Aug 2006, 18:39 GMT
Comments:Read Comments (63) | Post a comment
Article Rank:
9.38 / 10
by 39 visitors

Sometimes you have to generate some MS Office document for the users of your website using dynamic data. For example, few days ago, I had to generate some Excel reports using data from some tables in MySQL. I knew about the COM but it has a lot of disadvantages, including Windows-only platform and not very high speed. CSV is much easier and faster but you can't format the cells to make them better-looking. The method I've never thought about before was using HTML. So here came the inspiration and after some research and experiments I wrote this tutorial for all of you who are looking how to create Office documents on the fly using PHP. Of course, I included the COM methods and some methods to create other MS Office documents like DOC and PPT, to make this tutorial as full and as useful as possible.

How to generate Microsoft Office Documents (DOC, XLS, PPT) on the fly using PHP

There are two main approaches on building documents in MS Word, MS Excel and MS PowerPoint using PHP. The first is by using the COM library (only if you are running your PHP script on a Windows server) and the other is by "tricking" the Microsoft Office programs by using simple HTML or CSV (for Excel).

1. How to create a document with COM:

As I said above, COM is available only in Windows (for example if you are running Apache on Windows XP). By using COM you can launch Microsoft Word or any other available component (or custom component made by you and registered with regsvr32), fill in a document template and save the result as a Word document (as .doc, .rtf or other available formats) and send it to the users of your website.

It's very easy to use it. The code below shows how to create a Word .doc file:

<?php
$word
= new COM("word.application");
//To see the version of Microsoft Word, just use $word->Version
echo "I'm using MS Word {$word->Version}";
//It's better to keep Word invisible
$word->Visible = 0;
//Creating new document
$word->Documents->Add();
//Setting 2 inches margin on the both sides
$word->Selection->PageSetup->LeftMargin = '2"';
$word->Selection->PageSetup->RightMargin = '2"';
//Setup the font
$word->Selection->Font->Name = 'Verdana';
$word->Selection->Font->Size = 8;
//Write some text
$word->Selection->TypeText("Hello, universe!");
//Save the document as DOC file
$word->Documents[1]->SaveAs("C:\htdocs\hello2.doc");
// or use: $word->Documents[1]->SaveAs("C:htdocshello2.rtf",6); to save as RTF file
// or use: $word->Documents[1]->SaveAs("C:htdocshello2.htm",8); to save as HTML file
//And of course, quit Word
$word->quit();
$word->Release();
$word = null;
//Give the user a download link
echo '<a href="hello2.doc">Download file as .doc</a>';
?>

Here are screenshots of the MS Word document after downloaded and opened:

Word document created using PHP and COM

Here comes one of the most important questions - how to find the names and the parameters of these functions like "SaveAs". Just open Microsoft Word, press Alt+F11 to start the Visual Basic Editor and then press F2 (or View -> Object Browser). Find "ThisDocument" on the left. In the right frame you'll see the available variables and functions. Here is a screenshot showing the function SaveAs:

Object Browser

As you can see, the second parameter is the file format. Above, in the sample code, if you write 6, your document will be saved in RTF format. However, Microsoft Word allows many formats. To see their numbers find "wdSaveFormat" in the left frame, click on the desired format in the right frame and you'll see its number. This procedure is similar in the other Office programs (however, for example, the Save Formats are displayed in PpSaveFileFormat in Power Point).

Creating Excel .xls file is similar. The code below creates an Excel file and fills one of the cells. If you get your data from a SQL server you can use "for" but don't forget to "Activate" a cell before writing in it.

<?php
$excel
= new COM("excel.application");
//Keep Excel invisible
$excel->Visible = 0;
//Create a new workbook
$wkb = $excel->Workbooks->Add();
$sheet = $wkb->Worksheets(1);
//This code adds the text 'Test' on row 2, column 4
$sheet->activate;
$cell = $sheet->Cells(2,4);
$cell->Activate;
$cell->value = 'Test';
//Save the file just like the Word file above
$wkb->SaveAs("C:\htdocs\excel123.xls");
//Quit MS Excel
$wkb->Close(false);
$excel->Workbooks->Close();
$excel->Quit();
unset(
$sheet);
unset(
$excel);
?>

And here is the file opened with Microsoft Excel:

Excel file generated with PHP and COM

If you need to create a presentation using some dynamic data, here is how to create a PowerPoint .ppt file. You can create as many slides as you want and then add elements inside by using "Slides[number_of_slide]":

<?php
$powerpnt
= new COM("powerpoint.application");
//Creating a new presentation
$pres=$powerpnt->Presentations->Add();
//Adds the first slide. "12" means blank slide
$pres->Slides->Add(1,12);
//Adds another slide. "10" means a slide with a clipart and text
$pres->Slides->Add(2,10);
//Adds a textbox (1=horizontal, 20=left margin, 50=top margin, 300=width, 40=height)
$pres->Slides[1]->Shapes->AddTextbox(1,20,50,300,40);
//Adds a 16-point star (94=16 point star, 100=left margin, 200=top margin, 300=width, 300=height)
$pres->Slides[1]->Shapes->AddShape(94,100,200,300,300);
//Save the document as PPT file
$powerpnt->Presentations[1]->SaveAs("C:\htdocs\byeworld.ppt");
//And of course, quit Power Point
$powerpnt->quit();
//Give the user a download link
echo '<a href="byeworld.ppt">Download file as .ppt</a>';
?>

To understand the meaning of each function, just open the Object Browser. It's on the same place as in Microsoft Word (Alt+F11 to open Visual Basic Editor, F2 to open Object Browser). It's really interesting to experiment with these functions.

2. Using HTML (or CSV for Excel):

Of course, if you are running your PHP script on a UNIX server or you don't want to use COM, there is an alternative (I recommend using these alternative methods unless you really need to do something special in your documents). It's much faster but you won't have the control over the document that COM provides.

Probably you know that you can create and read HTML files with MS Word. Here comes the idea to format the content just like any other HTML file and write it in a file with ".doc" extension.

<?php
$filepnt
= fopen("hellohtml.doc", 'w+');
$content = "<html><head></head><body><b>Say hello</b> to my http server</body></html>";
fwrite($filepnt, $content);
fclose($filepnt);
echo
'<a href="hellohtml.doc">Download as .doc</a>';
?>

Here is a screenshot of the file opened with Microsoft Word:

Word document created using PHP and HTML

For Microsoft Excel, you need to create a file in CSV format (tab-delimited). You can save it in both .csv and .xls. The PHP code is much like the previous one:

<?php
$filepnt
= fopen("newfile.xls", 'w+');
//This is an example of a table about some users of an example website
//Of course, if you are getting the data from MySQL (or somewhere else) the code should be formatted better
$content = "Id\tUsername\tE-mail\tLevel\n"; //"\t" means a TAB and "\n" is a New line
$content .= "1\tWebmaster\twebmaster@example.com\t1\n"; //every new line is a new row in the table
$content .= "2\tmysql_fan\tmysql@php.be\t3\n";
$content .= "3\tfedora\tfedora@redhat.com\t3\n";
fwrite($filepnt, $content);
fclose($filepnt);
echo
'<a href="newfile.xls">Download as .xls</a>';
?>

Here is a screenshot of the file opened with Microsoft Excel:

CSV Excel document

Excel also can open HTML files. It allows you to make the table look better. Here is an example:

<?php
$filepnt
= fopen("newfilehtml.xls", 'w+');
//This is an example of a table about some users of an example website
//Of course, if you are getting the data from MySQL (or somewhere else) the code should be formatted better
$content = "<table border="1"><tr><td bgcolor="#CCCCCC"><b>Id</b></td><td bgcolor="#CCCCCC"><b>Username</b></td></tr> <tr><td>1</td><td>Webmaster</td></tr> <tr><td>2</td><td>mysql_fan</td></tr> <tr><td>3</td><td>slackware</td></tr></table>";
fwrite($filepnt, $content);
fclose($filepnt);
echo
'<a href="newfilehtml.xls">Download as .xls</a>';
?>

Here is how it looks like:

HTML Excel document

Microsoft PowerPoint opens HTML files, too, so if you just replace the XLS extension with PPT in the code above, here is how PowerPoint renders the table:

PPT HTML document

It's all about writing plain text in a file, so you can create these Office documents using Python, Ruby or any other language as well. These PHP examples are just to show how it works.

Creating ZIP archives using PHP

It's a good idea to archive the files to save some hosting bandwidth. Especially the Microsoft Office documents can be really large sometimes (if they are created with COM or manually). I've been searching a lot and it seems that the most easy and simple way to create a ZIP file is to use the ziplib class. Here is how it can be implemented:

<?php
include("ziplib.php");

$zipfile = new Ziplib;
$zipfile->zl_add_file("Here is the content of File No.1. For example, this could be your just generated XLS file using the methods above.","thenameofthefile.xls","g9");
$zipfile->zl_add_file("And this could be your DOC file's content.","letter.doc","g9");
//You can stream the ZIP file or write it in a file on your server
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename="file.zip"");
echo
$zipfile->zl_pack("You can leave a comment in the ZIP file");
?>

You can download the Ziplib class here (.zip, 7.14 KB), (.tar.gz, 5.15 KB). Put the 3 php files in some directory and include the "ziplib.php" file.

Streaming the file directly

If you prefer, instead of creating and saving the document on the server and giving the user a download link, you can stream the file directly. Just add this code in the beginning of the php file:

<?php
header
("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=myexcelreport.xls");
header("Pragma: no-cache");
header("Expires: 0");

...

//And here echo the document's content instead of writing it into a file on your server
?>

Alternatives of the Content-Type above are "application/vnd.ms-excel" for MS Excel files and "application/msword" for MS Word files.

I hope that this tutorial was useful for you. If you have any comments or if you've seen an error, feel free to post your comment below. Thank you.

Tags: , , , , ,

Back to top

Bookmark this article:

Permalink | Save to del.icio.us | Save to furl | Save to MyWeb 2.0 at Yahoo

Rank this Article:

Comments:

1. Bidfreelancers.com wrote: (08 Aug 2006, 07:58 GMT)
cool men its gr8. i tried , this is what i was looking for

http://www.Bidfreelancers.com

2. php phping wrote: (08 Aug 2006, 12:57 GMT)
I used CSV for excel files before but this with the html looks much better. it's just a normal html table.

3. Markus Fischer wrote: (09 Aug 2006, 13:39 GMT)
As long as you only need to generate some simple excel files, you can use PEARs excel writer from http://pear.php.net/package/Spreadsheet_Excel_Writer . It does not have any external dependencies, so running on Linux is fine.

4. Carlos Arevalo wrote: (12 Aug 2006, 01:12 GMT)
John thanks a lot for this tips, they worked beauty.
Good jod on this article

5. Enrique Figueroa wrote: (15 Aug 2006, 19:20 GMT)
I tried the first example on an XP PC with IIS 6.
I got the following error with the Word COM example:

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': Access is denied. ' in C:\Inetpub\wwwroot\RSPWeb\createword.php:2 Stack trace: #0 C:\Inetpub\wwwroot\RSPWeb\createword.php(2): com->com('word.applicatio...') #1 {main} thrown in C:\Inetpub\wwwroot\RSPWeb\createword.php on line 2

Is there sth I missed? Maybe with the IIS configuration?

Thanks a lot for any comment.

6. JohnLocke wrote: (15 Aug 2006, 20:57 GMT)
Enrique, this could be a solution to this permissions problem:

Login in WinXP with your Administrator account. Go to Control Panel -> Administrative Tools -> Component Services -> Computers -> My Computer -> DCOM config. In the right frame find "Microsoft Word", right click, Properties. Go to the security tab, select Customize in "Launch and activation" and click "Edit". In the dialog box add the user where the IIS is running and allow this user to access the Word's component.

7. Mark wrote: (19 Aug 2006, 16:50 GMT)
Hey folks - I'm having a similar problem as above on permissions , But have not found any settings to change. I am administrator on this machine , and am using php to create text files in a folder. It will write to existing text files , but if it doesn't exist it tells me it is not writable.

Any help out there ?

8. John wrote: (19 Aug 2006, 18:04 GMT)
If you are using "w+" in fwrite and it doesn't work, you can try this:

if(!file_exists("test.txt"))
touch("test.txt");

// Here just write to it without problems because now it exists

9. Mark wrote: (19 Aug 2006, 20:03 GMT)
John - You are a SAINT !!!

I even tryed Microsofts suggestions - and it was a waste of time -

Thanks Ever so much :)

10. Kunal wrote: (22 Aug 2006, 08:20 GMT)
Is there any way to convert power point file into html using php?

11. nath wrote: (24 Aug 2006, 06:55 GMT)
how about working doc generation on linux

12. Rael wrote: (24 Aug 2006, 10:46 GMT)
Don't forget MS formats are proprietary - so creating them without COM is very difficult if not impossible.

13. ado wrote: (06 Sep 2006, 14:46 GMT)
Is the Com component installed without installing office?

14. Maura wrote: (06 Sep 2006, 17:59 GMT)
I am trying to create a powerpoint presentation using the html tags but when I add to my file <img src="http://hosnamet/directory/image.jpg" border="0"> powerpoint doesn't like it and ignores the tag. Does anybody knows how to fix this or have a sugestion?

15. Maura wrote: (06 Sep 2006, 18:02 GMT)
I am trying to create a powerpoint presentation using the html tags but when I add to my file the img tag pointing to http://hostname/image.jpg powerpoint doesn't like it and ignores the tag. Does anybody knows how to fix this or have a sugestion?

16. John wrote: (06 Sep 2006, 19:28 GMT)
Maura, the img tag works on my Powerpoint, here is the contents of the PPT file I'm using:

<html>
<head><title>Title of file</title></head>
<body>
<img src="http://hostname/picture.jpg" />
</body>
</html>

17. Maura wrote: (07 Sep 2006, 12:59 GMT)
John, I am using this syntax but it is still not working. Do you think it could be because I am testing on Mac OS X 10.4.7 and PowerPoint 2004 for Mac? It shouldn't be the case... do you have any ideas?

18. PB wrote: (13 Sep 2006, 01:03 GMT)
John, When running your code for creating a new word document I keep getting the folowing error message: Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in C:\www\DocGen\ProcessWordDocument.php on line 31
line 31 contains: $word->Selection->TypeText("Hello, universe!");
I get the same error message on the next line:
$word->Documents[1]->SaveAs("C:\hello2.doc");

The com object responds because it tells me: I'm using MS Word 8.0
I have been trying to figure it out for several days now and I am not getting any further, please help

19. PB wrote: (13 Sep 2006, 01:11 GMT)
John, When running your code for creating a new word document I keep getting the folowing error message: Warning: (null)(): Invoke() failed: Type mismatch. Argument: 2 in C:\www\DocGen\ProcessWordDocument.php on line 31
line 31 contains: $word->Selection->TypeText("Hello, universe!");
I get the same error message on the next line:
$word->Documents[1]->SaveAs("C:\hello2.doc");

The com object responds because it tells me: I'm using MS Word 8.0
I have been trying to figure it out for several days now and I am not getting any further, please help

20. Seth wrote: (13 Sep 2006, 15:51 GMT)
Is there anyway to utilise what you have done here to open a current word document already with content and add further content at the beginning without using com?

I have tried a few variations to use fopen to open the word document and add further content to the beginning of thefile, I have suceeded in adding the new content but the content already in the file comes out corrupt when I download the file.

Any help would be fantastic!

21. PB wrote: (19 Sep 2006, 13:32 GMT)
I solved my problem of 13 sep by upgrading to word 2003. It all works now.

Thansk anyway.

22. John wrote: (19 Sep 2006, 15:10 GMT)
I thought the problem was the old Word 97 but couldn't find a solution (unless update). It's good it works now.

23. VH wrote: (28 Sep 2006, 15:34 GMT)
The php plugin woks grate, but only with save the file on server. I´ve tried to use the stream sulurion and in the .doc file only the echo commands will show!? what i´m doing worng??

2. question:
is ist possible that i start word and and automaticly past a autotext entry??

and 3. and last question:
could i find a way to past a adress that comes out of an sql database, so that it will be Past at an textmark???

THX for help

24. TG wrote: (16 Nov 2006, 10:37 GMT)
Great tutorial! However I'm trying to make more slides in a single powerpoint file, is this possible with the HTML method?

Many thanx in advance!

25. John wrote: (16 Nov 2006, 17:14 GMT)
TG, I've tried to do this before (like two html docs in a single file and similar experiments) but unfortunately it seems impossible to be done with HTML.

26. Amit wrote: (16 Nov 2006, 20:08 GMT)
i tried the header option but everytime it gives me the warning as:
Cannot modify header information - headers already sent by (output started at /home/hetawal/meyers/public_html/exam2.php:8)

27. Saravanan.R wrote: (05 Dec 2006, 08:55 GMT)
Hi JohnLocke,

Thanks for the nice tutorial.

I need more info about methods which is to insert a TEXT in TEXT BOX for Powerpoint Slides, and to Change the FONT, SIZE, Etc... for my Powerpoint Slides on FLY.

Thanks in advance.

awaiting for your reply.

28. prade wrote: (13 Dec 2006, 11:30 GMT)
header("Content-Disposition: attachment; filename="file.zip"");

Above line gives a parse error.

Anyways, this is a very good tutorial, covers most of it. Thanks a lot.

29. prade wrote: (13 Dec 2006, 11:55 GMT)
Hey, i just tested some of it, it all work just fine. Thanks again. Great work!

30. Kirankarthikeyan wrote: (04 Jan 2007, 10:01 GMT)
how to make use of rtf format for linux servers to generate a doc file

31. palanisamy wrote: (30 Jan 2007, 11:47 GMT)
nice article. this is what im expecting

32. J.Brown wrote: (08 Mar 2007, 06:56 GMT)
I was completely unaware that you could write non-binary HTML code, save it as an XLS file, and read it in OpenOffice/MS Office. Explanation is straight to the point and immediately useful. This page is greatly appreciated.

33. yayh wrote: (11 Mar 2007, 07:53 GMT)
when i am trying to use create a doc file using php com i get the following error :

I'm using MS Word 11.0
Fatal error: Call to a member function TypeText() on a non-object in C:\Inetpub\temp\index.php on line ...

$word->Selection->TypeText("Hello, universe!"); // error is here !

please help i tried everything...

note: i am using windows server 2003 sbs and php 5 and office 2003

note2: i succeed to run php com to create an XLS, PPT file using the above code.

34. yayh wrote: (11 Mar 2007, 08:15 GMT)
when i am trying to use create a doc file using php com i get the following error :

I'm using MS Word 11.0
Fatal error: Call to a member function TypeText() on a non-object in C:\Inetpub\temp\index.php on line ...

$word->Selection->TypeText("Hello, universe!"); // error is here !

please help i tried everything...

note: i am using windows server 2003 sbs and php 5 and office 2003

note2: i succeed to run php com to create an XLS, PPT file using the above code.

35. hex wrote: (15 Mar 2007, 16:42 GMT)
To the comment above: I've read some time ago that there's a problem in some cases with some of the latest versions of PHP. Maybe this causes the problem. The .doc code works fine here.

36. yayh wrote: (20 Mar 2007, 12:22 GMT)
PHP Version 5.1.2 installed
on Windows SBS 2003 + Ms office 2003

please guide me what to do and which version did you use with above code.

37. Greg Caulder wrote: (23 Mar 2007, 20:39 GMT)
Im having a different problem. Im sure i have to change something in my PHP.ini file but im unsure of what to change. thisi s the error on my Server 2003 comp.

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Word<br/><b>Description:</b> Command failed' in D:\HTTP\SDC\stores\barcode\generate.php:8 Stack trace: #0 D:\HTTP\SDC\stores\barcode\generate.php(8): variant->Open('C:/reminder.doc') #1 {main} thrown in D:\HTTP\SDC\stores\barcode\generate.php on line 8


Any suggestions. In desperate ned of help.

38. Greg Caulder wrote: (23 Mar 2007, 20:50 GMT)
Ok i have coppied and pasted the exact Word example and this is the error that im getting.

I'm using MS Word 11.0
Fatal error: Call to a member function TypeText() on a non-object in D:\HTTP\SDC\stores\barcode\generate.php on line 17

39. urat wrote: (17 Apr 2007, 03:10 GMT)
how do i stream an excel file created using the PHP-COM method discussed above?
the given sample saves the output file to disk and I want to bypass that.
TIA.

40. Tom wrote: (17 Apr 2007, 12:55 GMT)
I tried the powerpoint section. Why can't I save the file?
Error Message:
Fatal error: Cannot pass parameter 1 by reference in C:\xampplite\htdocs\ppt.php on line 14
Line 14 is:
$powerpnt->Presentations[1]->SaveAs("C:\xampplite\htdocs\byeworld.ppt");
Any suggestion? Thanks

41. Hyrum wrote: (27 Apr 2007, 22:36 GMT)
I use header("Content-Type: application/vnd.ms-excel"); to export my html page to EXCEL How do I get to include three worksheets and/or a macro sheet?

42. David wrote: (05 May 2007, 01:17 GMT)
When I try the above code to stream an XLS file I always get the following error when the file is opened: "The file is corrupt and cannot be opened".

All of the formating is correct and the file can be saved and viewed properly in Notepad or Wordpad. I use \t for the tabs and \n for the newlines. I even parse all of the data to make sure that there are no special characters or quotes. Any ideas?

43. Matt wrote: (22 May 2007, 20:01 GMT)
Hello, this is an excellent tutorial and so far it's worked perfectly for me! However I'm having trouble finding the code to add headers/footers with page numbers to the doc. Anybody have any useful links/knowledge? Thanks.

44. Mo wrote: (08 Jun 2007, 20:04 GMT)
The only problem are manipulation limitations with using HTML to generate the PPT/XLS.

PPT: you cannot add new slides. All rendered html is displayed on one slide, regardless of how much data. This is a serious limitation.

XLS: you can only dispaly on one worksheet. You cannot add additional worksheets.

45. chandrashekhar wrote: (13 Jun 2007, 05:49 GMT)
very nice artical.

46. Deep wrote: (13 Jul 2007, 07:16 GMT)
My script example.php generates an fatal error stating that the com class is non-existent. However, I'm using Microsoft Standard edition 2003. My OS is Windows XP 5.1.2600 SP2.

Could anyone tell me the reason why this failure is occuring?

Thanks in advance,
Deep

47. joey wrote: (22 Sep 2007, 02:10 GMT)
anyone have a solution to Call to a member function TypeText() issue?

48. suci wrote: (05 Oct 2007, 12:14 GMT)
nice example
thank u .
it is very helpful tome

49. Juan Carlos wrote: (16 Oct 2007, 19:34 GMT)
hello, i'm using the Streaming the file directly:
I do teh msql query put it in a table and then i send it to the xls file it works charms with 18 rows but if the table has more than 18 rows i.e. 19 rows the streaming doesn't work it do nothing at all.
any ideas on this misbehavior. thanxs in advance

50. safi wrote: (03 Dec 2007, 09:55 GMT)
looks cool,
Dads what i've been lukin4

51. Sikkandar wrote: (06 Dec 2007, 08:21 GMT)
I am using linux platform, but I need to read the .doc file contnets using php, how could I get the solution for this problem.

52. www.phprtf.com wrote: (13 Dec 2007, 07:54 GMT)
For creating Microsoft Word documents in rtf format, try library from www.phprtf.com .

53. Fel wrote: (23 Dec 2007, 03:34 GMT)
Can I add a column chart too in the powerpoint ?

54. Fel wrote: (23 Dec 2007, 03:59 GMT)
Can I add a column chart too in the powerpoint ?

55. gagan wrote: (11 Jan 2008, 11:27 GMT)
i want to use excel file in wordpress in order to display data in the form of posts.... but getting this error while using word2003...infact working fine on word2002XP version...


Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Office Excel<br/><b>Description:</b> A document with the name 'qw.xls' is already open. You cannot open two documents with the same name, even if the documents are in different folders. To open the second document, either close the document that's currently open, or rename one of the documents.' in D:\Program Files\EasyPHP 2.0b1\www\wordpress\wp-content\plugins\excel2wp\class_excel.php:26 Stack trace: #0 D:\Program Files\EasyPHP 2.0b1\www\wordpress\wp-content\plugins\excel2wp\class_excel.php(26): variant->Open('D:\Program File...') #1 D:\Program Files\EasyPHP 2.0b1\www\wordpress\wp-content\plugins\excel2wp\inputExcel.php(45): ExcelWP->XL('qw.xls', 'D:\Program File...', NULL) #2 {main} thrown in D:\Program Files\EasyPHP 2.0b1\www\wordpress\wp-content\plugins\excel2wp\class_excel.php on line 26

56. Dhillon wrote: (11 Jan 2008, 11:34 GMT)
getting this online... in wordpress ...Excel object is not created in LINUX server...please help me....as i m using this function in code

function excelwp()
{
// Instantiate Excel
$this->ex = new COM("Excel.sheet") or Die ("Did not instantiate Excel");

return 1;
}


PHP Fatal error: Class 'COM' not found in /home/deftsoft/public_html/excel2blog/wp-content/plugins/excel2wp/class_excel.php

57. Pasha wrote: (15 Jan 2008, 01:58 GMT)
Great article, helped exactly when I thought there is no solution.

But! I have a problem opening the .doc with the COM class. The process is initiated, but the window won't appear, it's just seen as a process in task manager. And also the script blocks and doesn't respond.
Is it a COM class error or something with win / msword?
Thnx a lot!

58. ade_ari_w0@yahoo.com wrote: (15 Jan 2008, 09:34 GMT)
please give example code to generate Microsoft office doment like as .doc using PHP at Linux OS.

Thank you

59. Pravin Gundawar wrote: (31 Jan 2008, 09:40 GMT)
how to create excel report having data and charts using php on Linux or unix

60. Mike wrote: (25 Feb 2008, 07:05 GMT)
Hi,

We are using new COM("powerpoint.application") to generate ppt in our php projet. They were working but now it has stopped working on the server. Same same code works in another server. Has anybody come across this problem ?

regards,
Mike

61. rachma wrote: (26 Mar 2008, 03:03 GMT)
thank you

62. zues wrote: (05 Apr 2008, 14:06 GMT)
is it possible to search for a bold (or italic, underlined) word in Word doc? this can be done in VBA but what about using PHP and COM?

63. sharon wrote: (09 Jun 2008, 01:36 GMT)
Our wholesale jewelry is a website where you will find the highest quality and lowest price jewelry conveniently. Besides, we have customer service and professional guidance.Since2004, tangjewelry.com has established long-term cooperation with thousands of customers from dozens of countries. 99% of customers expressed their satisfaction with our products and service. To know more details, please enter our web, www.tangjewelry.com

Post a comment:

Back to top

informBank -
informBank | Profiles | Archive

©2005-2008 informBank. All content in this website is property of informBank except on the pages where is specified otherwise.
RSS Feed:
Contact us at webmaster @ informbank . com