General discussion

Topics: Developer Forum, Project Management Forum, User Forum
Coordinator
May 17, 2007 at 11:06 AM
General discussion forum topic.
Jun 1, 2007 at 1:45 AM
Outputted files crash Office 2007 when attempting to print. There doesn't seem to be a rhyme nor reason; saving the file, re-opening and printing works, though.

Thanks for the awesome library!
Coordinator
Jun 1, 2007 at 6:58 AM

PureForm wrote:
Outputted files crash Office 2007 when attempting to print. There doesn't seem to be a rhyme nor reason; saving the file, re-opening and printing works, though.

Thanks for the awesome library!

Can you send me a copy of the crashing file? (maarten at the name of this project dot net)
Jun 2, 2007 at 6:27 AM
I also have the same problem,
but how can i send you the crash file.
Coordinator
Jun 2, 2007 at 5:06 PM
You can send the file to me by email, maarten AT phpexcel DOT net
Jun 3, 2007 at 2:37 PM

maartenba wrote:
You can send the file to me by email, maarten AT phpexcel DOT net

i already send the file to you
Jun 14, 2007 at 11:45 PM
Hi! I want to put a image in excel 2007 file header.
Is there a way to do it with phpexcel 2007?. Can you give me an example?

Thanks.
Coordinator
Jun 18, 2007 at 9:27 AM
It should be possible according to the specs, but haven't implemented it yet in PHPExcel. If you really want this, can you create a new issue for it?
Jun 20, 2007 at 10:25 AM

jmmurillo wrote:
Hi! I want to put a image in excel 2007 file header.
Is there a way to do it with phpexcel 2007?. Can you give me an example?

Thanks.



maartenba wrote:
It should be possible according to the specs, but haven't implemented it yet in PHPExcel. If you really want this, can you create a new issue for it?


In the documentation, at section "4.3.5. Setting the print header and footer of a worksheet" it mentions a code for background image. That is &G Code for "picture as background" . Is there a way to use this option tu put a image at header background??
Coordinator
Jun 21, 2007 at 12:55 PM
I'd say: try it :-)
Haven't had the time to look into this yet, so if you find a workaround, feel free to share it here.
Jun 26, 2007 at 7:59 AM
hai.. i'm new to this php class... i'm now still using excel 5 (excel 2003). when i was trying this class to my php code, i was confused because
the document said that i can write in excel5 format, but i didn't find the resulted file.. furthermore, i want to be able to edit excel5 (read and write)
Coordinator
Jun 26, 2007 at 8:05 AM

rinorino wrote:
hai.. i'm new to this php class... i'm now still using excel 5 (excel 2003). when i was trying this class to my php code, i was confused because
the document said that i can write in excel5 format, but i didn't find the resulted file.. furthermore, i want to be able to edit excel5 (read and write)

Excel5 support will be added in the next release, planned later this week. (only writing)
Jun 26, 2007 at 9:38 AM
do you plan a chart-support (bar/pie) in one of the next releases?
this would be a great feature. couldn't find a class out there that supports excel-charting (php).
btw. outstanding work :-P
Coordinator
Jun 26, 2007 at 10:10 AM

fks wrote:
do you plan a chart-support (bar/pie) in one of the next releases?
this would be a great feature. couldn't find a class out there that supports excel-charting (php).
btw. outstanding work :-P

It's planned, but no idea in which release yet...
Jun 29, 2007 at 8:47 AM
wow... your update for this class is great... i'm really thank you for your job... :)
Jul 2, 2007 at 11:31 AM
hai... i found something strange message when i'm trying to read a xslx file, the message is like this :

Warning: simplexmlloadfile(zip://../Classes/wa.xlsx#_rels/.rels) function.simplexml-load-file: failed to open stream: No such file or directory in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 85

Warning: simplexmlloadfile() function.simplexml-load-file: I/O warning : failed to load external entity "zip://../Classes/wa.xlsx#_rels/.rels" in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 85

Notice: Trying to get property of non-object in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 86

Warning: Invalid argument supplied for foreach() in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 86

i'm using the newest wampserver, and i've already turned on php_zip... could you please help me...
(btw, your job is relly great...)
Jul 2, 2007 at 4:30 PM
rinorino wrote:

Warning: simplexml_load_file(zip://../Classes/wa.xlsx#_rels/.rels) [function.simplexml-load-file]: failed to open stream: No such file or directory in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 85


Please provide us the file and the procedure by which it has been created. The wa.xlsx#_rels/.rels most probably really doesn't exists.
Jul 3, 2007 at 1:30 AM
i place the wa.xlsx (excel file) inside the Classes folder, and i also place my code (try.php) inside the Classes folder too.
Here are the code of try.php :

<?php
/*Error reporting */
errorreporting(EALL);

/* Include path */
iniset('includepath', iniget('includepath').';../Classes/');

/* PHPExcel */
include 'PHPExcel.php';

include 'PHPExcel/Reader/Excel2007.php';
$objReader = new PHPExcelReaderExcel2007;
$objPHPExcel = $objReader->load("../Classes/wa.xlsx");

?>
Coordinator
Jul 3, 2007 at 6:32 AM
Which software have you used to create wa.xlsx? Was it Office2007?
Jul 4, 2007 at 10:46 AM
Hello everyone!

I've got a question.

Is there an easier way to set all the cells on a sheet a color fill than this one (here I set white fill to a block of 13 columns and 12 rows):
<?php
...

$columns = 'ABCDEFGHIJKLM';
for ($i = 0; $i < 13; $i ++) {
for ($j = 1; $j <= $row + 3; $j ++) {
if ($objPHPExcel->getActiveSheet()->getStyle($columns{$i} . $j)->getFill()->getFillType() != PHPExcelStyleFill::FILL_SOLID) {
$objPHPExcel->getActiveSheet()->getStyle($columns{$i} . $j)->getFill()->setFillType(PHPExcelStyleFill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle($columns{$i} . $j)->getFill()->getStartColor()->setARGB('FFFFFFFF');
}
}
}

...
?>

My method turned out to be really resource-intensive and rather slow... Is there a way to set fill to a groub of cells? Smth like
<?php
$objPHPExcel->getActiveSheet()->getStyleGroup('A1:M12')->getFill()->setFillType(PHPExcelStyleFill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyleGroup('A1:M12')->getFill()->getStartColor()->setARGB('FFFFFFFF');
?>

This moment is really important when processing a batch of XLS files in one script - mine just throws fatal exception about excess of memory limit. :(
Coordinator
Jul 4, 2007 at 12:08 PM
IAmEternaL, have a look at the documentation and " duplicateStyles" method. I think that's a good start for your problem.
Also note that XLS file format has some limitations on styling and memory.
Jul 5, 2007 at 2:43 AM
i use office 2002, and i use file type conversion for opening xslx, i downloaded it from microsoft.com
Coordinator
Jul 5, 2007 at 6:33 AM

rinorino wrote:
i use office 2002, and i use file type conversion for opening xslx, i downloaded it from microsoft.com

Can you send me or Jakub the file? maarten AT -or- jakub AT phpexcel D.O.T net
Jul 9, 2007 at 6:19 PM
Hello,

I downloaded the newest version 1.3.5 and I am still having issues while attempting to print / using print preview in Office 2007 version 12.0.6014.5000.

I have emailed both maarten and jakub the file.

Thanks!
Chris-
Jul 11, 2007 at 1:53 PM

rinorino wrote:
hai... i found something strange message when i'm trying to read a xslx file, the message is like this :

Warning: simplexmlloadfile(zip://../Classes/wa.xlsx#_rels/.rels) function.simplexml-load-file: failed to open stream: No such file or directory in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 85

Warning: simplexmlloadfile() function.simplexml-load-file: I/O warning : failed to load external entity "zip://../Classes/wa.xlsx#_rels/.rels" in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 85

Notice: Trying to get property of non-object in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 86

Warning: Invalid argument supplied for foreach() in D:\www\lurn\codeplex3\Classes\PHPExcel\Reader\Excel2007.php on line 86

i'm using the newest wampserver, and i've already turned on php_zip... could you please help me...
(btw, your job is relly great...)



Hi,

I have this problem too.
I have this error when I use examples too. No problem to write but I can't read.

I have tried to put all right for everybody on the folder but ... not :,(

Somebody have solutions ?

Thanks

Configuration :
Coordinator
Jul 11, 2007 at 2:15 PM
PopCorn, I'll put this on our todo list. Reason is we hard-coded the path to where the document properties are stored within the XLSX file.
Jul 11, 2007 at 2:21 PM

maartenba wrote:
PopCorn, I'll put this on our todo list. Reason is we hard-coded the path to where the document properties are stored within the XLSX file.


Do you have a date for the next release ? I try to update the Excel2007Reader class but it doesn't work :(

Great job, thanks
Coordinator
Jul 11, 2007 at 2:23 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 20, 2007 at 1:33 PM

PopCorn wrote:

Hi,

I have this problem too.
I have this error when I use examples too. No problem to write but I can't read.

I have tried to put all right for everybody on the folder but ... not :,(

Somebody have solutions ?

Thanks

Configuration :



I think this has something to do with php_zip module itself or there is some misconfiguration.

I have same problem (Apache under Windows) and I've done some testing with the subject. I created testing.xml file (valid file) and zipped it to testing.zip. Using Excel2007Reader and example reader code as template I created some basic tests.

<?php
//... Here is excelreader includes and other stuff

// getcwd() takes current folder
$pFilename = "zip://". getcwd() . "\\testing.zip#testing.xml";

/* FILE_EXISTS TEST, FAILS */
if (file_exists($pFilename)) echo "Works!"; // <- Fails

/* FOPEN TEST, WORKS */
$fh = fopen($pFilename, 'r');
$theData = fread($fh, 1000);
echo "<b>Fopen: </b>$theData<br /><br /><hr>"; // <- WORKS!
fclose($fh);

/* SIMPLEXML_LOAD_FILE, FAILS */
$rels = simplexml_load_file($pFilename); // <- Fails

?>

So for some reason file_exists and simplexml_load_file cant read using "zip://" stream, but fopen can.
Jul 20, 2007 at 3:00 PM
I created temporary and rough solution to this problem.

Open Excel2007.php (in directory: Classes\PHPExcel\Reader)

Replace following rows with code posted below the row number. All code are supposed to go on one line, so remove possible line breaks.

Row 85:
$rels = simplexml_load_string($zip->getFromName("_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");

Row 89:
$xmlCore = simplexml_load_string($zip->getFromName("$rel[Target]"));

Row 105:
$relsWorkbook = simplexml_load_string($zip->getFromName("$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");

Row 110:
$xmlStrings = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");

Row 124:
$xmlStyles = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");

Row 147:
$xmlWorkbook = simplexml_load_string($zip->getFromName("$rel[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");

Row 152:
$xmlSheet = simplexml_load_string($zip->getFromName("$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
Coordinator
Jul 20, 2007 at 4:49 PM
DamienThorn, thank you for pointing this out! We knew about file_exists not working on a zip archive, but it seems there are even more streams not working...
I created a work item and update code. 1.4.0 on monday will include this fix.
Coordinator
Jul 20, 2007 at 4:52 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 23, 2007 at 4:05 PM
Edited Jul 23, 2007 at 4:06 PM
Hello
I downloaded the version 1.4.0 and I'm having a few problems with it.
1. The reader doesn't seem to work for me, when I run 07reader.php in the test directory I receive the following output:
http://pastebin.com/f650b28f8

2. Office 2007 crashes when trying to print, this happened with the version 1.3.5 as well.

Any ideas?
Coordinator
Jul 23, 2007 at 5:55 PM
1. Download again, the fix was not in the build this morning...
2. Outstanding bug at Microsoft, will be fixed when MS finds the problem...
Jul 23, 2007 at 6:26 PM
Thanks for your reply, however I am still having some trouble with the reader.
The output is http://pastebin.com/m6e07fef1 .
Coordinator
Jul 23, 2007 at 8:25 PM
What PHP version are you using?
Jul 23, 2007 at 8:58 PM
PHP Version 5.2.2 with php_zip enabled.
Jul 24, 2007 at 12:56 AM
Is this a viable option for creating large formatted reports (20,000+ lines and column alignments and column width) in a timely manner?

I've been tinkering with this for a few days and see a huge potential, but the fact that it takes 33 seconds to generate 2900 formatted lines is making me think this isn't going to work as a web reporting tool.

I guess what I'm asking, is there a way to make it run faster? I really like this tool and want to make this work. It does everything I need and more....It just does it too slow.
Coordinator
Jul 24, 2007 at 6:59 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jul 24, 2007 at 7:01 AM
@husker475: Will be fixed in 1.4.5, if you drop me an e-mail (somewhere in a previous post you can find my email address), I'll send you a fixed file for now.
@funjay: What features do you plan using? Excel5 writer or Excel2007 writer?
Jul 25, 2007 at 4:42 AM
Hi,
I'm new in php excel. I sucessfully generated xls file by your sample code. But, I can't found any download notification in my browser. The file was saved to php file folder (hhtp folder). I tried using another samples and found similar result. Why?
Coordinator
Jul 25, 2007 at 6:30 AM
You should save the file to a temporary location, then stream it to the browser (for example using fpassthru).
Jul 25, 2007 at 4:10 PM
Hi
I'm still having problems reading .xlsx files. Here are my testfiles, the results and error messages:
http://rapidshare.com/files/44961474/Tests.rar.html
Jul 25, 2007 at 6:17 PM

maartenba wrote:
@funjay: What features do you plan using? Excel5 writer or Excel2007 writer?

At the moment I am using the Excel2007 writer. Other than just writing the data, I'm also using the column width autosizing, and setting the horizontal alignment(I set the alignment for row 1 and use the duplicateStyle() function to copy it to the rest of the cells in the column). If I can get this to work for larger reports I'd also like to freeze the header columns, and possibly code in functions for subtotaling.
Coordinator
Jul 26, 2007 at 7:06 AM
@husker475: Please e-mail, problem solved...

@funjay: My own benchmarks resulted in this speed (approximately):
Number of rows Seconds to generate
200 3
500 4
1000 6
2000 12
4000 36
8000 64
15000 465

Slow speed on the writer is caused by the Zip library, we are investigating a means of making that process faster...
Coordinator
Jul 31, 2007 at 7:37 AM
husker475, can you send me the output of your phpinfo() ?
Jul 31, 2007 at 1:17 PM

maartenba wrote:
husker475, can you send me the output of your phpinfo() ?

Email sent.
Aug 10, 2007 at 7:37 PM
I would like simply to send to the client browser the xls output without
saving an intermediate file, how can it be done?
Thanks
Coordinator
Aug 13, 2007 at 6:43 AM

prandini wrote:
I would like simply to send to the client browser the xls output without
saving an intermediate file, how can it be done?
Thanks

You can send the necessary headers to the browser, and then $objWriter->save('php://output');
Aug 13, 2007 at 8:48 AM
Thank a lot, I didn't know! Now I am more indepth into PHPExcel, there are
some methods that I need : setLocked and hideGridlines, but cannot figure
out how to invoke them, could someone please advice? Thanks again
Coordinator
Aug 13, 2007 at 10:28 AM

prandini wrote:
Thank a lot, I didn't know! Now I am more indepth into PHPExcel, there are
some methods that I need : setLocked and hideGridlines, but cannot figure
out how to invoke them, could someone please advice? Thanks again


Gridlines -> I created a work item for that (http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=3063).
Locked -> Can you please specify more details on what this should do?
Aug 13, 2007 at 10:35 AM
I saw the methods hideGridlines and hideScreenGridlines in the source code,
is it possible to invoke those? They are in Excel5 writer, but it is ok for me.
setLocked is already there ( in Excel5 writer) ; the operation of locked is quite
simple, it protects the formula, otherwise Excel 2007 complains about the formula
not being locked.
Aug 13, 2007 at 3:16 PM
I found a bug in PHPExcel/Writer/Excel5/Worksheet.php

function _storePanes($panes)
{

$y = isset($panes0) ? $panes0 : null;
$x = isset($panes1) ? $panes0 : null;
$rwTop = isset($panes2) ? $panes0 : null;
$colLeft = isset($panes3) ? $panes0 : null;

but starting at line 2463 it should obviously be

$x = isset($panes1) ? $panes1 : null;
$rwTop = isset($panes2) ? $panes2 : null;
$colLeft = isset($panes3) ? $panes3 : null;

I hope some developer corrects the error in the repository.
Coordinator
Aug 13, 2007 at 4:26 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Sep 5, 2007 at 6:59 PM
I use some web hosting company to host my web.
This company cannot enable php_zip for me.
It suggests me to use Zlib compression.
How can PHPExcel module use Zlib? Any configurations required?
Coordinator
Sep 6, 2007 at 8:00 AM
It really should be php_zip I'm affraid...
Oct 19, 2007 at 9:38 PM
I seem to have something wrong on my Apache2 / php5.2.4 install. A am simply attempting to run the excel5 example and open the file. The file is generated, but I get an excel error blah.xls cannot be accessed whenever I attempt to open it. I have Excel 2000 and 2003 that give the same error. Sometimes 2003 repairs the file and displays it with no formatting.

I have php_zip and all of the xml exts. installed. Any help would be greatly appreciated.

grant
Jun 21, 2008 at 5:21 PM
hi every body

thank you for your work, i'll probably integrate it in an open source software i'm working on: silex, a flash cms based on a template système

for now i try to display a formula and the result of this formula but it doesn't work:
1/ In excel 2002,
in cell A1 I put "1"
in cell A2 I put "2"
in cell A3 I put "=SUM(A1:A2)" (in fact I write "=SOMME(A1:A2)" since my excel is in French)
I save it in a .xls file

2/ In php,
I open the .xls file
in cell A1 I put "25"
display the cell A3 value
=> it should output "=SUM(A1:A2)" with getValue and "27" with getCalculatedValue
=> instead it outputs "3" and "3" which was the result of the formula when I saved the excel file...

3/ I printed the content of the sheet with print_r: print_r($objPHPExcel->getActiveSheet());
=> it contains only the values, no formulas...

I think it could be because of the 2002 version of the file or because my excel is in french, so the formula I write is with SOMME instead of SUM...

can you help me ?
thank you very much
lex.
Jun 22, 2008 at 1:17 AM
ok I tried with a xlsx file instead of xls (it has been a big deal to convert it)
now it works: formulas are kept as is

my problem is now that the "word" INDEX is not recognised by PHPExcel... is it normal? if there is a simple way to modify the formulas with INDEX in it, then it would be ok for me.
for example I have a cell with "=INDEX(Q18:Q31;EQUIV(S18;R18:R31;0);1)" which gives a "#NAME?" in PHPExcel
thank you in advance,
lex.
Coordinator
Jun 23, 2008 at 7:17 AM
INDEX is currently not implemented.
Jun 24, 2008 at 8:12 PM


maartenba wrote:
INDEX is currently not implemented.

Thank you for your reply.
Is there a list of implemented functions?
Is MATCH implented?
thank you again,
lex.

Coordinator
Jun 25, 2008 at 8:45 AM
Edited Jun 25, 2008 at 8:53 AM

lexayo wrote:

Is there a list of implemented functions?
Is MATCH implented?

Date and Time Functions

DATE
DATEDIF - Undocumented in Excel
DATEVALUE
DAY
DAYS360
EDATE
EOMONTH
HOUR
MINUTE
MONTH
NETWORKDAYS
NOW
SECOND
TIME
TIMEVALUE
TODAY
WEEKDAY
WEEKNUM
WORKDAY
YEAR
YEARFRAC - Not yet in CVS

Engineering Functions

BESSELI
BESSELJ
BESSELK
BESSELY
BIN2DEC
BIN2HEX
BIN2OCT
COMPLEX
DEC2BIN
DEC2HEX
DEC2OCT
DELTA
ERF
ERFC
GESTEP
HEX2BIN
HEX2DEC
HEX2OCT
IMABS
IMAGINARY
IMARGUMENT
IMCONJUGATE
IMCOS
IMDIV
IMEXP
IMLN
IMLOG10
IMLOG2
IMPOWER
IMPRODUCT
IMREAL
IMSIN
IMSQRT
IMSUB
IMSUM
OCT2BIN
OCT2DEC
OCT2HEX

Financial Functions

EFFECT
FV
NOMINAL
NPER
NPV
PMT
PV
SLN
SYD

Information Functions

ISBLANK
ISERR
ISERROR
ISEVEN
ISLOGICAL
ISNA
ISNONTEXT
ISNUMBER
ISODD
ISTEXT
NA
VERSION

Logical Functions

AND
FALSE
IF
IFERROR
NOT
OR
TRUE

Lookup and Reference Functions

ADDRESS
CHOOSE - Not yet in CVS

Math and Trig Functions

ABS
ACOS
ACOSH
ASIN
ASINH
ATAN
ATAN2
ATANH
CEILING
COMBIN
COS
COSH
DEGREES
EVEN
EXP
FACT
FACTDOUBLE
FLOOR
GCD
INT
LCM
LN
LOG
LOG10
MOD
MROUND
MULTINOMIAL
ODD
PI
POWER
PRODUCT
QUOTIENT
RADIANS
RAND
RANDBETWEEN
ROUND
ROUNDDOWN
ROUNDUP
SERIESSUM
SIGN
SIN
SINH
SQRT
SQRTPI
SUBTOTAL
SUM
SUMSQ
TAN
TANH
TRUNC

Statistical Functions

AVEDEV
AVERAGE
AVERAGEA
BETADIST
BETAINV
BINOMDIST
CHIDIST
CHIINV
CONFIDENCE
COUNT
COUNTA
COUNTBLANK
CRITBINOM
DEVSQ
EXPONDIST
FISHER
FISHERINV
GAMMADIST
GAMMAINV
GAMMALN
GEOMEAN
HARMEAN
HYPGEOMDIST
KURT
LARGE
LOGINV
LOGNORMDIST
MAX
MAXA
MEDIAN
MIN
MINA
MODE
NEGBINOMDIST
NORMDIST
NORMINV
NORMSDIST
NORMSINV
PERCENTILE
PERMUT
POISSON
QUARTILE
SKEW
SMALL
STANDARDIZE
STDEV
STDEVA
STDEVP
STDEVPA
TDIST
TINV
TRIMMEAN
VAR
VARA
VARP
VARPA
WEIBULL

Text and Data Functions

CHAR
CLEAN
CODE
CONCATENATE
FIND
LEFT
LEN
LOWER
MID
PROPER
REPT
RIGHT
SEARCH
T
TRIM
UPPER

I'm currently working on more of the lookup and reference functions, but need to make some underlying changes to the parser to implement these, which will take more effort and require significantly more testing before it's in a state for release.

I'm also working on documenting all of the available functions, particularly to explain where there are differences between Excel and PHPExcel (eg handling of dates); and with examples of use both within worksheet formulae, and called statically for more general use within PHP scripts that need to perform mathematical calculations without the need to instantiate a workbook.
Coordinator
Jun 25, 2008 at 9:24 AM
A list of implemented functions is also outputted in one of the test scripts and should provide an up-to-date list.
Jun 26, 2008 at 4:39 PM
Ok it's a good start!
can you tell me if it is a big deal for an average professional php developper to add some funtions?
are you looking for contributors?
i am interested in INDEX and MATCH functions
it's a proposition in fact :-)
lexa.
Coordinator
Jun 26, 2008 at 6:36 PM
Thanks for the proposition :-)

Mark, is it currently possible (without your modifications) to let lexayo implement INDEX and MATCH?
Coordinator
Jun 27, 2008 at 8:50 AM
Edited Jun 27, 2008 at 9:58 AM


maartenba wrote:
Thanks for the proposition :-)

Mark, is it currently possible (without your modifications) to let lexayo implement INDEX and MATCH?

In their simplest form, yes; but not as a true implementation that matches Excel in all cases.
Most functions return a single value. Index in its simplest form ("=INDEX(A1:E3,2,3)") will only return one value.
However, it can also return an array of values when used certain parameter values (specifically 0 for the row or column). This is OK when used within more complex formulae ("=SUM(INDEX(A1:E3,2,0))"), but rather different when used to return a simple single value ("=INDEX(A1:E3,2,0)"). It's this last case that needs more fundamental rework.
Not to mention the slight difference in parameters passed in when used in reference form.
CHOOSE is another similar function that can return an array or a single value.

I've already implemented the simple form (not yet in CVS) and the simplest form of CHOOSE, and am working on testing the more complex variants at the moment; but they're not yet properly tested.

MATCH is a different case: it's a much simpler function because it does only return a single value in all cases, and so it fits within the existing code. I've not coded it yet but the basic mechanics are easy enough. The only things to watch out for are wild cards in the lookup value ("=MATCH('%~%',A1:E5,0), and ordering of the lookup array entries when match type is 1 or -1.
HLOOKUP and VLOOKUP could also be implemented with fairly similar logic, and it would be equally useful to implement these as well.

I'm quite happy if lexayo wants to take a look at coding these functions; and I'll make sure my latest code is in CVS for CHOOSE and INDEX, though they're not complete replications of the Excel logic.
I'll also check in my test scripts, or e-mail them to lexayo if he wants to have a go at implementing new functions.

Jun 28, 2008 at 8:45 AM
Ok Mark, I'll write an email to you
thank you !
Jul 7, 2008 at 8:47 AM
Hi
How do I center some text over 4 cells?
Thanks for a great library.
Developer
Jul 7, 2008 at 11:26 AM
Try something like this:

$objPHPExcel = new PHPExcel();
$ws = $objPHPExcel->getActiveSheet();
$ws->mergeCells('A1:D1');
$ws->setCellValue('A1', 'hello');
$ws->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

Jul 7, 2008 at 11:11 PM
koyama
Thank You
Jul 8, 2008 at 1:33 PM
Edited Jul 8, 2008 at 1:35 PM
The library is really great. And well documented. Thanks a lot!
The only few things.  As you can see I’m not English friendly. My mother language is Russian and I’m writing my site engine in Windows-1251 encoding. Is it possible to set encoding in one place instead of iconv(blab bla bla) any time in setValue()?

EncodedSpreadSheet extends SpreadSheet{
    function setValue($value){
        parent::setValue($this->encoding?iconv(UTF-8 to $this->ecnoding):$value);
    }
}

please.

Jul 8, 2008 at 1:45 PM
And the second question is about temlates and FIELDS.

For example i have prepared template in Excel, where all column are styled and there are few cells like [field name] styled to. And save it in report1.xlst:

[REPORTTITLE]  (the value of the fields will be inserted from script)

Column1          column2                column3
FFF                GGG                      HHH
(other row inserted by script and styled by previus line)
(other row inserted by script and styled by previus line)
(other row inserted by script and styled by previus line)
                       total                        =sum(C5:C6)            (the range of sum functin should resize automaticaly depending on count of inserted rows)


                                                      Posted by:   [REPORTAUTHOR]
                                                      Date:           [REPORTDATE]

This is the best way to design report in Excel and fill it by script. Does PHPExcel  provide something like this?
thanks for great lib