php generate image from excel cell range - php

I have an excel sheet. Its Cells can contain data and graph. I need to generate an image from the cells between a fixed range(for example: A1 to K19).
I found one solution to this problem with ASP.NET: Microsoft.Office.Interop.Excel. It provides method Range.CopyPicture() and Chart.Paste(). I need to implement this using PHP. Any solution, suggestion or direction will be appreciated.
For range A1 to B2, image can be like :

I would recommend you look into PHPExcel. It can read xls and xlsx files; after reading them you are able to create images from text just like you did before.

Related

How can i format the excel report though php application

How can i format the excel report though php application
I am able to generate the excel report in php but how can i do the formatting changes in the excel.
eg. I have to add image in excel.
Red borders to columns.
some background color to excel
Change the font color
Help appriciated
I don't think it is directly possible without any libraries.
Have a look at PHPExcel, You will be able to do what you are looking for.
Credits to Mark Baker.
Tougher Way
You will need to generate XHTML from your Excel document, After that you need to search and parse for tags and do your formatting and stuff.

PHPexcel doesn't read cell value, but Excel reads the proper cell value

I'm having weird issues when trying to get calculated value of one cell in one worksheet.
The thing is, PHPExcel writer does the good job and when I open generate file with excel, that cell contains for egg. 1.05, but when trying to read that same cell with PHPexcel again, I get 2.75.
Anyone experienced something similar?

Adding Macro on Excel XML-specification to generate a native

I'm exporting data in excel sheet via drupal view. Drupal views_export_xls module uses
http://code.google.com/p/php-excel/source/browse/branches/class-excel-xml.inc.php?r=9
library to export data into excel sheet. Every thing working fine. But i want little more from it.
How to add MACRO in excel sheet row or cell programmatically?
Is it possible to do so by php code?
If you look at above link - line no 88 & 93 which actually create cells and rows.
What i want to create a macro and place it on excel sheet that can later convert this generated excel file into native xml (.in) file for business purpose.
I've searched a lot but most of the link suggesting VB solution and i've no sense about this language.
Can anyone point me on right direction.
Any help would be greatly appreciated!
As far as I'm aware, unless the Excel writer that you're using is based around COM, then there is no way of creating a Macro in an Excel workbook.

How can i take an excel file, parse it contents and store the column's data of excel sheet in my database column?

There is one excel sheet which contains student name, rollno etc. How can i parse the contents of excel file and store that in my sql database?
You are looking for PHPExcel library i believe.
http://phpexcel.codeplex.com/
use this class to read the excel files
http://sourceforge.net/projects/phpexcelreader
If you want to do it directly from the Excel file, rather than create an intermediate CSV using Excel's "Save As" options, then look at libraries such as PHPExcel that can read the xls binary format and make the data accessible to your PHP script.
I'd recommend to you that you save it as csv, it's much more easier and less hacking to upload it to the database
here is simple a sample
http://www.bradino.com/php/csv-upload-to-database/
PHPExcel is one of the best PHP classes i have ever worked with. In addition to parsing and reading files of all Excel variations (including csv) the output to Excel 2007 + is excellent.
Be sure to look at the documentation and examples...they will get you up to speed very quickly

CSV files and multi line text cells

I am generating a simple csv file using php. The file contains some user's personal data.
When I open the generated file in office, the addresses are not displayed in full height. I have to double click on the cell for the address to be shown fully (in full width and height) otherwise I can only see the first word/number of the address.
Also, I have date of births displayed as ######, I have to expand the whole column to see them fully.
This doesn't happen in open office.
Is there any way to force MS Office to show all fields in full? Because otherwise it'll be to confusing for the people who will use (Hey where are all the details!:)
Thanks :)
I don't think you can "format" your sheets with CSV. You will have to produce some other file format that Excel understands. I would suggest XML which is really easy to generate.
Just make a sample sheet with the data you want, save it as XML and you'll see how your file should be generated.
Or you could use some ready-made PHP solution for writing excel files if you can't be bothered with analysing the XML file.
you could try the auto-size columns feature.
This is a UI issue with how Excel works, you can't force Excel or anything else how they handle it.
The quickest work around is to perhaps create an XLS file that runs a macro to retrieve the CVS file and format the cells as needed, but there's nothing you can do inside the CSV to affect what Excel is displaying.

Categories