I am trying to export excel file from the mysql as per the answer in
Exporting data to excel sheet in php. The export is successful. But I would like to know about the styles. Can I make one line bold, italic etc in the excel file? And can I insert a table using this excel export?
Thanks!
https://www.google.com/search?q=php+excel+styling
yeilds:
PHPExcel: Coloring the cells?
PHPExcel specific cell formatting from style object
PHPExcel style problem
PHP Excel style formatting using col & row index
Style a range of cells with phpexcel
PHPexcel cannot reads styles from xls
SO is endless with information, and that's just the first page of results
Related
I want to modify an already existing excel sheet with delete the formula used in the sheets using PHP.
I tried to use php Spreadsheet. Not able to delete the formula used the excel sheets
Is there some way I can modify the already existing excel sheet with removing the formula using PHP?
At the moment of this writing the current version of PHPExcel is version 1.8.0. I know how to make a chart and embed it in a worksheet, I basically followed the provided example.
Excel allows to either embed a chart into a worksheet or otherwise make a chart sheet. A chart sheet has it's own 'tab' in Excel and Excel keeps the chart scaled to the available size in the window.
Now what I would like to know is: how to add a chart sheet with PHPExcel? Is this possible with PHPExcel 1.8.0 using the 'Excel2007' writer?
As stated by #MarkBaker in the comments, the answer is simply "No" (at least not in version 1.8.1).
In my use case I was using PHP to generate an Excel workbook based on some processed data from different sources. What I did is to add VBA in Sub Workbook_Open() on the generated workbook to move the chart from a worksheet to it's own chart sheet. Then I used PHPExcel->getMacrosCode() to export the binary string of macro code to some file.
Now when generating files I add that binary string with PHPExcel->getMacrosCode(String) and save it as .xlsm instead of .xlsx. It is a bit of a hassle, but this is how I work around this problem for me.
Note that depending on your use case you might also need to generate a certificate to sign the code, to allow your user to always trust macros.
Ive been trying to wrap my head around using PHPexcel and would like ot know if there is any other simpler solution.
Using PHPexcel i am able to load a standard .xsl file and pick the exact cell i need to import.
$code = $data->val(2,2,0);
echo $code
Now this works perfectly, it will echo the second cell in the second row without any issues. problem is the spreadsheets i need to parse are all in .xlsx format which PHPexcel does not support.
Is there an alternative to PHPexcel which will allow me to simply extract a single cell in a .xlsx file?
I'm using code from http://forums.codeguru.com/archive/index.php/t-470940.html to create excel in php. Is there a way to add styles like bold and/or italic to cells when doing it that way? Thank you
The method shown in that thread does not generate an Excel .xls file. It generates a tab-separated-value file. This is a plain text format, that does not support styling of any kind
If you want to generate a real xls file with formatting, then look at some of the libraries that can be used from PHP to write actual Excel files such as my PHPExcel library
EDIT
In addition to PHPExcel, you can find details of other PHP libraries for writing real Excel files in the answer to this question
Please help me about my doubts on excel and php. I need to do the following process on excel report generation using php
to change cell's font styles
to change cell's BG color
to change cell's width
Try PHPExcel. I started using it few days ago and it works very good.
With PHPExcel
http://phpexcel.codeplex.com/wikipage?title=Features
http://phpexcel.codeplex.com/wikipage?title=Examples
With PEAR Spreadsheet Excel Writer
Format::setBgColor – Sets the cell's background color
Format::setFontFamily – Sets the font family.
Worksheet::setColumn – Set the width of a single column or a range of columns.
I'd definitely recommend PHPExcel as well, and it may well supercede the SEW within the PEAR repository