bigzhangx / php-excel

Automatically exported from code.google.com/p/php-excel
MIT License
0 stars 0 forks source link

Formulas? #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 pilavd...@gmail.com on 21 Mar 2007 at 7:35

GoogleCodeExporter commented 8 years ago
Jepp, this is true. I am already working on allowing at least the most simple
mathematic operations. Stay tuned for an update beginning of next week. 
Currently
it's really just a data dump into an xml file.

Original comment by oliver.s...@gmail.com on 22 Mar 2007 at 8:49

GoogleCodeExporter commented 8 years ago
I just took a look into the formula thing and I am quite impressed how excel 
deals
with this. However, I am not sure how to implement such a feature. Adding 
formular
usage to the class will definitely make it lose it's "lightweight".

Original comment by oliver.s...@gmail.com on 10 Sep 2009 at 3:48

GoogleCodeExporter commented 8 years ago
Hello!

For a personal project I made this little modification to AddRow method to put 
a simple formula at worksheet

if (preg_match('/^=/', $v)) {
        $type = 'Number';
        //<Cell ss:StyleID="s21" ss:Formula="=100-(RC[-2]*100/RC[-3])"><Data ss:Type="Number"></Data></Cell>
        $cells .= "<Cell ss:Formula=\"$v\"><Data ss:Type=\"$type\"></Data></Cell>\n";
}

OBS: RC it's cells offset from current position
I know this resolv my own issue and it's far from being a global solution , but 
may could help.

Bye!

Original comment by perr...@gmail.com on 27 Sep 2009 at 10:12

GoogleCodeExporter commented 8 years ago
I've checked various possibilities to insert formulas into the excel/XML 
document. Quite easy, when parsing the 
equal sign "=" at the beginning of the string. However, I decided, not to 
support formulas in version 1 releases 
of the library.

Introducing formulas insertion needs more than the creation of an array for 
dumping into excel. So a preparation 
wrapper would be the best way to enter single cells, add up to rows and finally 
to columns. This exceeds the idea 
of a simple dump library.

Original comment by oliver.s...@gmail.com on 29 Sep 2009 at 6:37