I want to know if PHPExcel can:
Create Excel spreadsheets with embeded image. The image must be compressed (jpeg, png, gif...).
Create Excel spreadsheets for different Excel versions (2000, 2003, 2007...).
I'm pretty sure it can do this but I can't find it in the official docs.
Anyone familiar with this class can help?
Thanks!
Yep. It works great for all of the above. If you download the latest version there are docs in the Documentation/PHPExcel developer documentation.doc
Section 4.4.38 pg 26 shows how to add a GD drawing to a sheet.
Section 6.2.2 pg31 shows how to export in Excel 2007 format. Subsequent pages show other excel versions, and there is a useful set of tips on getting the right headers etc to make the .xls downloadable.
PS let me know if you need sample code... will post it here.
Related
I am using fusioncharts/3.2.4 library for rendering charts on webpage. I searched on google but could not find an answer to how can I export fusion charts in excel/PDF using custom export buttons?
Note: I dont want to use any builtin library aswell.
I searched and found that fusioncharts/3.2.4 does not provide native excel export functionality.
Thanks in advance.
i'm working with the 3.11.3 and doesn't appear any at the XLS but the PNG and PDF work well.
but this can answer your question: i found something that can help you
You can explicitly use action based framework for this and export the excel in the way you want. I have used Apache POI for this, but you can use any of the library for this.
If you want the image of this chart as a part of excel, you can create the string of chart with the use of any backend technology and embed it with a static html content, making static html file.
Test the file by opening in browser, if it is same as that of your application expectation.
Then use 'wkhtmltoimage-0.12.5-1.exe' to generate graph image with proper wait time, and embed this generated image inthe new sheet of the excel file.
I'm currently using PHP with the PEAR extension, as well as the Spreadsheet_Excel_Writer package. I am able create a new excel file with PHP and save it to disk, but I can't find a stable Excel reader package.
Even if I do find a valid reader package I don't think this will be suitable as I want to be able to modify a complex excel document which contains its own formulas and graphs(on seperate spreadsheets) based on the content already saved in the data table.
Ideally, I'd like to enter data from the browser which will then, with PHP, modify only certain cells and then save the file again, the excel document itself will then update its own graphs etc. based on the modified data in the table.
Any ideas? Or have more experience with PEAR and know of packages for working with excel documents in this manner?
Thanx a lot!
You probably don't want separate reader and writer libraries, otherwise you're going to have to transfer all data between them manually, which limits you to libraries that can both read and write.
There's a comprehensive list of Excel libraries for PHP here
However, unless you use COM or PUNO, you'll have problems with graphs... even PHPExcel doesn't support charts yet, and (while planned for the the next release) will still only work with charts in OfficeOpenXML (.xlsx) files.
Hi everybody
I'm using CKeditor to edit and generate some reports for my php project. But I need to export the edited texts from CkEditor to Open office and Microsoft word format. So what I need is a class or component which has a function like these :converttoodf($htmlcode) converttodoc($htmlcodes) which return odf and doc format.
However, The doc and Odf file should be without problem , and the pictures and tables should be shown nicely.
In addition, No matter if yr solution be commercial, I may buy it cause I really need it urgently
Tnx in advance and hope can get the right answer asap , here
XLS:
http://docraptor.com/ (automatic conversion from HTML)
or
http://phpexcel.codeplex.com/ (manual building of file, just like phpword from another answer)
DOC
You can get away with just saving the HTML with inline css styles applied and saving it as a .doc. Not sure about how to display images there though.
ODT
http://incubator.apache.org/zetacomponents/documentation/trunk/Document/tutorial.html
more info: http://www.slideshare.net/tobyS/presentation-5028656
You might want to take a look at phpword... i know it supports html documents but im not sure if you can jsut load some source and save it out - you may have to build the document programatically.
If you need ODT anyway, then I'd recommend using OpenOffice via commandline. There is http://www.artofsolving.com/opensource/pyodconverter which can convert between pretty much all Office formats.
HTML import shouldn't be a problem. Don't be foiled by the PDF example. Input and output formats can vary. http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.html
My application is fetching a data dynamically from MYSQL and displaying. The Problem is even i have to give the option to "Export to Xls" file. And these file should be in a A4 size, so i should customize the font size of contents in the Xls file to fit into the A4 size.And i need to insert if possible image into the file.
Please help me to solve this as i am new to php and need to complete it within a day.
You can use
PHPexcel or
PEAR_Spreadsheet_Writer
php_excel extension by Ilia Alshanetsky (this requires a commercial license for libXL)
to create the Excel Sheets.
I'm creating Excel files in a PHP project. Those files aren't just CSV data... They are multiple tabs spreadsheets with functions and formatting.
So far I'm using the Spreadsheet_Excel_Writer class that is provided with Pear.
Everything is fine but our users don't like 2 things:
When they open those files generated by PHP, modify them with Excel and save those changes, Excel ask to upgrade the file format because it was saved to version 5.0/95.
Files are way too large because of the embedded images. As far as I know the only way to add images with Spreadsheet_Excel_Writer is with insertBitmap which add 24 bit bitmaps to the document.
I would like to address those issues. I'm pretty sure #1 can't be done as you can see there. But is there a way to add compressed images (jpeg) to the document?
If it's not possible to modify Spreadsheet_Excel_Writer to meet my needs, what are your class recommendations for this? Searching questions here leaded me to PHPExcel. Are there any other good alternatives out there?
If possible I would like to stick with Spreadsheet_Excel_Writer because changing to another class would be much more work (those generated spreadsheets are quite complex).
I'm using PHP 5.2.9.
I ended up using PHPExcel. With this class I can avoid point #1 since I can save in may formats (including Excel 2003/2007). For point #2 it's possible and PHPExcel do this already. When you chose the old Excel format, PHPExcel extends Spreadsheet_Excel_Writer in order to save the file.
It was a pain to rewrite my the code to use the new class but it was worth it since PHPExcel is really nice.
I've done this with PHP using XML for the spreadsheets. Check out this link for the XML spreadsheet: http://msdn.microsoft.com/en-us/library/aa140066(office.10).aspx and http://blogs.msdn.com/dmahugh/archive/2006/12/10/images-in-open-xml-documents.aspx for inserting images.