erioncuni85 / php-excel Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/php-excel
License: MIT License
Automatically exported from code.google.com/p/php-excel
License: MIT License
PHP-Excel ========= This is a small library written in PHP to generate an Excel file (in MicrosoftXML format) out of a two-dimensional array. It is NOT a full-grown solution to handle some serious data interchange between databases <> PHP <> Excel, but a small and simple way of throwing out an XML natively readable by Excel to the browser. Author: Oliver Schwarz <[email protected]> Project: http://code.google.com/p/php-excel/ Issues: http://code.google.com/p/php-excel/issues/list Version: 1.1 Version 1.1 ----------- After revitalizing the project this version now addresses several issues in the bugtracker. On my way to version 2 I wanted to publish an intermediate version to fix some stupid errors I did in the first run. Version 2 now allows: * The setting of an encoding (default: UTF-8) * The automagic type identification for strings/numbers It fixes: * An issue (#3) with large arrays and implode * An issue (#7) with other charsets than iso-8859-1 * An issue (#9) with XML entity encoding (still not 100%) Version 1 --------- This was the first version, released on March, 8th 2007. It was usable for many people using the ISO-8859-1 charset and for small arrays. However, it had some serious flaws using other charsets or using larger data containers. License ------- Please see the included license.txt for details (it's MIT license) or visit: http://www.opensource.org/licenses/mit-license.php ...for more details. Tutorial -------- To get the export running, first create a two-dimensional array (please stick to 2 dimensions, the library does not work with complex arrays): $a = array(); for($i=0;$i<10;$i++) $a[] = array('Cell' . $i); Instanciate the library and give the array as input: $xls = new Excel_XML(); $xls->addArray($a); Generate the XML/Excel file. This method should trigger the browsers "Save as..." dialog: $xls->generateXML('test'); Optional values --------------- 1) You may set your own charset in the constructor of the class: $xls = new Excel_XML('UTF-8'); 2) You may activate/deactivate type identification for table cells (strings/numbers): $xls = new Excel_XML('UTF-8', true); Whereas the values are: 'true' = type identification active, 'false' (default) = type identification inactive. 3) You may set the worksheet title directly in the constructor: $xls = new Excel_XML('UTF-8', true, 'Testsheet'); Problems, Errors, Help ---------------------- If problems or error occur I unfortunately can not provide any support. However, please visit the projects website and post an issue to the comments or bugtracker. Thanks.
if we want to store data "</Data>", this will conflict width excel format
so i add <![CDATA[ ]]> to avoid this,
the changes was in the file attached.
Original issue reported on code.google.com by [email protected]
on 8 Oct 2009 at 8:20
Attachments:
What steps will reproduce the problem?
When using $xml->generateXML($filename) the filename is used without proper
validation of allowed characters. This may cause errors when delivering out
the file.
What is the expected output? What do you see instead?
Use a whitelist filter to correct the filename before sending out the files.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2009 at 12:24
What steps will reproduce the problem?
1. Send a value with character "ñ" to AddRow method
What is the expected output? What do you see instead?
I expect the correct word "compañia"
I see a blank value
What version of the product are you using? On what operating system?
excel-class 1.1
php 5.2.x
osx leopard 10.5.8
Thanks!
Original issue reported on code.google.com by [email protected]
on 29 Sep 2009 at 3:00
How can i generate excel file with freeze rows?
Original issue reported on code.google.com by [email protected]
on 15 Apr 2012 at 8:08
What steps will reproduce the problem?
1. Generate a very large Excel file (>7000 lines)
What is the expected output? What do you see instead?
You'll most likely get:
Allowed memory size of 16777216 bytes exhausted (tried to allocate 189
bytes) class-excel-xml.inc.php on line 188
I fixed this by changing the implode() line on 188 to the following for-loop:
$length = count($this->lines);
for($i=0; $i<$length; $i++) {
echo $this->lines[$i] ."\n";
}
Original issue reported on code.google.com by spamprotection
on 12 Jun 2007 at 9:47
What steps will reproduce the problem?
1. put text containing an: ampersand, apostrophe, double-quote, less-than
and/or greater-than in the data for a cell.
2. Excel will fail to read the resulting file, complaining that illegal XML
characters are found.
Please provide any additional information below.
Text in cells must be XML encoded using:
str_replace(''', ''', htmlspecialchars($text, ENT_QUOTES));
Original issue reported on code.google.com by [email protected]
on 28 Oct 2008 at 9:29
What steps will reproduce the problem?
I have a script that's sole purpose is to remove a few columns from a
spreadsheet that is passed to it. The total work w/ PHPExcel is:
$xl = PHPExcel_IOFactory::load($filename);
$ws = $xl->getSheet();
$ws->removeColumn('C', 7);
$writer = PHPExcel_IOFactory::createWriter($xl, 'Excel5');
$writer->save($outputfile);
After running the xls through the script, the final row still has the
columns that should be removed and I have to remove the data from those
cells manually.
What is the expected output? What do you see instead?
I would expect that the columns removed would be removed throughout the
entire worksheet.
What version of the product are you using? On what operating system?
PHP 5.2.9
Initially used PHPExcel 1.1
Most recent test using PHPExcel svn pull on 1/21/2010
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Jan 2010 at 4:28
I need to use a debugger (or something) to measure the performance of the
class methods. I am too unsure to decide whether I use array_slice or a for
loop to resize an array which is possibly too large to handle.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2009 at 4:17
What steps will reproduce the problem?
1. Output a xls file with this library.
2. Open it in Excel2007.
3. You may meet a format error tip.
Original issue reported on code.google.com by [email protected]
on 23 Jan 2011 at 3:23
I added this code on the next line of 132(after htmlentities function)
$v = str_replace("\n", ' ',$v );
so that you can make newline in the cell data.
Original issue reported on code.google.com by [email protected]
on 6 Oct 2011 at 6:58
What steps will reproduce the problem?
1. Copy test.php's code into the page I created below
2. Launch the page
3. Nothing appears
What is the expected output? What do you see instead?
The arrays contain data but nothing happens. I am able to print_r($excelSheet)
and confirm it
contains data. I have also used the test.php code to confirm it is not my array
that is the issue. It
is really puzzling - even if I copy paste the test.php code, and made sure that
the class file is in
the same folder, nothing appears. The rest of my page functions as expected.
What version of the product are you using? On what operating system?
Latest version (the 2009 build)
Please provide any additional information below.
Please see attached file
Original issue reported on code.google.com by [email protected]
on 10 Dec 2009 at 3:18
Attachments:
What steps will reproduce the problem?
1. call
2. text
3. drive
What is the expected output? What do you see instead?
duplicate
What version of the product are you using? On what operating system?
xp
Please provide any additional information below.
yes
Original issue reported on code.google.com by [email protected]
on 4 Mar 2015 at 11:43
What steps will reproduce the problem?
1. input cyrillic characters in the array
2. save the file as UTF-8
3. run it
What is the expected output? What do you see instead?
xls file - the text is corrupt
What version of the product are you using? On what operating system?
php-excel Version 1.0
Please provide any additional information below.
Try without utf8_encode(); I guess the strings in the array "should" be
UTF-8 and utf8_encode() is not necessary.
Original issue reported on code.google.com by [email protected]
on 20 Sep 2007 at 10:28
Added initial support to save to filepath.
Original issue reported on code.google.com by matt.daemon660
on 11 Oct 2012 at 12:32
Attachments:
Please write a readme file and include it in the first downloadable version.
Original issue reported on code.google.com by [email protected]
on 8 Mar 2007 at 3:12
Change private $header to
"<?xml version=\"1.0\" encoding=\"%s\"?\>\n
<?mso-application progid=\"Excel.Sheet\"?>\n
<Workbook xmlns:o=\"urn:schemas-microsoft-com:office:office\"
xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"
xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\">";
Change header to
header("Content-Type: application/force-download; charset=" . $this->sEncoding);
header("Content-Disposition: inline; filename=\"" . $filename . ".xml\"");
Now a download dialog will appear, click open, Excel will display the XML
without any messages.
Original issue reported on code.google.com by [email protected]
on 27 Mar 2011 at 6:37
Attachments:
When opening the generated file with Excel 2010, it pops up a window saying
"The file you are tring to open is in a different format than specified by the
file extension ... Do you want to open the file now?"
When clicking yes, it works fine, however, this should really be avoided. Also,
with LibreOffice the opening of the file without any renaming is not possible.
Thank you
Original issue reported on code.google.com by [email protected]
on 20 Nov 2012 at 7:27
I can't see a way to pass formulas to excel. Without this, it is of very
limited use.
Original issue reported on code.google.com by [email protected]
on 21 Mar 2007 at 7:35
A similar module exists elsewhere:
http://phpexcel.codeplex.com/
Consider merging the projects or at least sharing relevant code. HTH.
Original issue reported on code.google.com by [email protected]
on 5 Aug 2010 at 5:35
Open the dowloaded File into Open Office
Instead of a Excel Spread Sheet, It looks like a word Doc
v1.0, PHP 5, WinXP (Apache/PHP server as well)
Original issue reported on code.google.com by [email protected]
on 27 Jul 2007 at 6:17
I came across a major compatibility issue with Internet Explorer 7 and
Microsoft Office 2007/3.
Headers sent cause IE to try to open the file inline but for the 90% of
tests the content was corrupted or IE was unable to handle the file.
I fixed the problem changing content disposition header to attachment
header("Content-Disposition: attachment; filename=\"" . $filename . ".xls\"");
and with 2 additional headers that force the browser to not cache the request.
Here's the final piece of code
// deliver header (as recommended in php manual)
header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Disposition: attachment; filename=\"" . $filename .
".xls\"");
Original issue reported on code.google.com by [email protected]
on 11 Jul 2007 at 12:14
Can you post any way to save to file not stream?
Original issue reported on code.google.com by [email protected]
on 31 Dec 2012 at 6:30
When i am trying to export arabic character it's getting like "?????????"
Original issue reported on code.google.com by [email protected]
on 5 Aug 2014 at 9:06
What steps will reproduce the problem?
1. Open xls file
2.
3.
What is the expected output? What do you see instead?
When i downloaded xls file. I open it with MS Office but still loading...
What version of the product are you using? On what operating system?
Im using MS office 2007 2010 and 2013 to open but still loading and can't open
file. I try to open with notepad++ and see XML struct as i need. But can't open
by MS Excel T_T.
Please provide any additional information below.
Please help me.
Thank alot!
Original issue reported on code.google.com by [email protected]
on 6 May 2013 at 10:41
What steps will reproduce the problem?
1. add some rows that have numbers in them
2. download
3. Excel gives Number Stored as text error.
What is the expected output? What do you see instead?
Excel gives Number Stored as text error.
What version of the product are you using? On what operating system?
1.0 on Mac OSX.
Please provide any additional information below.
Here is my fix:
foreach ($array as $k => $v):
$ssType = "String";
if(is_numeric($v)) {
$ssType = "Number";
}
$cells .= "<Cell><Data ss:Type=\"".$ssType."\">" .
utf8_encode($v) . "</Data></Cell>\n";
endforeach;
Original issue reported on code.google.com by [email protected]
on 1 Oct 2007 at 4:19
hello,
First, i want to thanks for author for very usefull code :).
I sow problem and can't fix it.
when i use loop like this
for ($i=1; $i<5; $i++){
echo"<Row><Cell ss:StyleID=\"s52\"><Data ss:Type=\"String\">
</Data><NamedCell ss:Name=\"Print_Area\"/>$i</Cell></Row>";
}
everthing generate ok, but if i use
for ($i=1; $i<11; $i++){
echo"<Row><Cell ss:StyleID=\"s52\"><Data ss:Type=\"String\">
</Data><NamedCell ss:Name=\"Print_Area\"/>$i</Cell></Row>";
}
everthing is stoping and broke excel report generation. How need to fix it?
please help..
thanks in advance
Original issue reported on code.google.com by [email protected]
on 5 Aug 2007 at 10:48
What steps will reproduce the problem?
1. XML format
<proejctName>XYZ</projectName>
<details>Add any 254 characters length string here</details>
2. sendFile() function sends data to xls file, but when you open a file it show
File Error: Data ma have been loss
for 253 character long string it works perfectly well..
What is the expected output? What do you see instead?
Expected o/p show print 254 charastre string in xls
What version of the product are you using? On what operating system?
v1.1
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 27 Feb 2012 at 5:42
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.