odsPhpGenerator

NEWS : What is odsPhpGenerator

What is odsPhpGenerator

2009-12-09 : Laurent VUIBERT
odsPhpGenerator is a small and easy library writen in PHP 5.0 for generate OpenDocumentSpreadsheet.

For use it, you need only PHP 5.0, DOM, and Zip

Re : What is odsPhpGenerator

2010-01-23 : sreenadh
Good work Laurent. And thanks.

Doubts:
column autowidth?
cell word-wrap?

Thanks in advance

PS: please display license information on this site.

Re : Re : What is odsPhpGenerator

2010-01-23 : Laurent VUIBERT
Thank sreenadh,

I currently do not find how to "column autowidth" but I find ways to reduce the text automatically as it enters a cell.

I also added the ability to wrap the cut with automatic word

and finally I also add the "vertical-align" for cells. that's revising 0.0.3

see: svn

PS: I have also add copyright in the site

Re : Re : What is odsPhpGenerator

2010-01-26 : Laurent VUIBERT
Re

I add the function odsStyleTableColumn-> setUseOptimalColumnWidth (true / false) for autowidth, it is part of the documentation odf, but it is unfortunately not supported by OpenOffice yet.

see:
http://qa.openoffice.org/issues/show_bug.cgi?id=13843

Re : What is odsPhpGenerator

2010-09-15 : Rubén Caro
I just needed to add independent borders to a cell (border bottom, top, left and right), and as it was not implemented (and it seemed quite simple), I just added to the code. It seems to work just fine, so maybe you want to merge it on your svn.

Basically changes are just replicating the code around preexisting \'border\' style.

all changes are on file odsStyle.php:

line 209:
$this->border_bottom = false;
$this->border_left = false;
$this->border_right = false;
$this->border_top = false;

line 239:
public function setBorderBottom($border) {
$this->border_bottom = $border;
}

public function setBorderLeft($border) {
$this->border_left = $border;
}

public function setBorderRight($border) {
$this->border_right = $border;
}

public function setBorderTop($border) {
$this->border_top = $border;
}

line 317:
if($this->border_bottom)
$style_table_cell_properties->setAttribute(\"fo:border-bottom\", $this->border_bottom);

if($this->border_left)
$style_table_cell_properties->setAttribute(\"fo:border-left\", $this->border_left);

if($this->border_top)
$style_table_cell_properties->setAttribute(\"fo:border-top\", $this->border_top);

if($this->border_right)
$style_table_cell_properties->setAttribute(\"fo:border-right\", $this->border_right);


That\'s it !
Hope it\'s useful.

Re : Re : What is odsPhpGenerator

2010-09-15 : Rubén Caro
Already made some more changes to page formatting:

$ods->setPrintOrientation(\'landscape\');
$ods->setPageWidth(\'29.7cm\');
$ods->setPageHeight(\'21.0cm\');
$ods->setMarginTop(\'6.0cm\');
$ods->setMarginBottom(\'0.5cm\');
$ods->setMarginLeft(\'2.5cm\');
$ods->setMarginRight(\'0.5cm\');
$ods->setHeaderDisplay(\'false\');
$ods->setFooterDisplay(\'false\');

If you want the code to add to your svn just tell me and I send you the files. (ruben.caro@lanuez.org)

Thanks !

Re : Re : What is odsPhpGenerator

2010-09-20 : Rubén Caro (ruben.caro@lanuez.org)
Found a bug when dealing with row style. It works on my code now.

Also added class odsDrawImage extends odsDraw to try to bypass the corruption problem when adding images, but no luck.

With my code you can do this now:

$image=new odsDrawImage(\"sites/all/modules/pef/imatges/logo.png\");
$image->setX(\'22.59cm\');
$image->setY(\'0.0cm\');
$image->setWidth(\'3.84cm\');
$image->setHeight(\'2.17cm\');
$table->addDraw( $image );

After repairing the file (letting OO32 do this) it looks exactly as it should, placing and resizing the image correctly.

When I look at the generated XML it looks as it should though, so I have no clue about what the problem might be. Maybe some little option that OO32 expects and it\'s not there, but I don\'t see it could be important enough to say \"The file is corrupted\"...

So many changes so far, can\'t place them here, so just ask me for my files to see them all.(ruben.caro@lanuez.org)

Hope it helps.

Re : What is odsPhpGenerator

2011-03-16 : sothea
When I donwload odsphpgenerator and testing the example folder, It is not work. It display message in \"Warning: domdocument::domdocument() expects parameter 2 to be long, string given in C:\\wamp\\www\\test\\odsPhpGenerator-0.0.2\\odsPhpGenerator-0.0.2\\ods.php on line 194\" in ods file. why it like this?

Re : What is odsPhpGenerator

2010-03-01 : Iribarren
Hi Lauren,

Nice work with odsPhpGenerator!

I think i found a typo/bug in odsTableRow.php in line 12

if($odsStyleTableRow) $this->styleName = $odsStyleTableRow->getName;

Should be

if($odsStyleTableRow) $this->styleName = $odsStyleTableRow->getName();

Re : Re : What is odsPhpGenerator

2010-03-13 : Laurent VUIBERT
Thank you, I have fix it in my trunk.

Re : What is odsPhpGenerator

2010-04-07 : Andrea Zagli
first of all, thanks for odsPhpGenerator

i installed it, but every ods that it creates it seems damaged (says openoffice, but it try to repair the file and then it open the file regularly)

what am i doing wrong?

Re : Re : What is odsPhpGenerator

2010-04-26 : kapralov (kapralov@gmail.com)
I confirm this feature.

Re : Re : Re : What is odsPhpGenerator

2010-04-28 : Laurent VUIBERT
I know this bug and it is fixed by rev 20 in svn :

r20 | lapinator | 2010-01-26 21:24:43

UPD: bugs in the generated ods fixed, The OOo 3.2 no error now


The examples using r20

Re : Re : Re : Re : What is odsPhpGenerator

2010-04-28 : Diego V
Thanks! Keep the good work.

Re : Re : Re : Re : What is odsPhpGenerator

2010-09-13 : Rubén Caro
The bug is back on rev24. The lines you changed on rev20 to fix it are back again like they were on rev16.

Just a typo I guess.

Great work !!

Re : Re : Re : Re : Re : What is odsPhpGenerator

2010-09-13 : Rubén Caro
Ooops, I reply myself. I totally mixed up. The changes you made on rev20 are still there on rev24, but the bug is really back.

Re : Re : Re : Re : Re : Re : What is odsPhpGenerator

2010-09-14 : Rubén Caro
The bug occurs when adding a cell image.

I guess that just happens when adding an image file that is not PNG, as the code (ods.php:line 92) forces the extension to be \'.png\'.

I will check that and give feedback here.

Re : Re : Re : Re : Re : Re : Re : What is odsPhpGenerator

2010-09-14 : Rubén Caro
Feedback: with PNG image does the same. Now there is no name conflict with the image file (is already *.png), but OO3.2 still complains. Seems to be something about adding an ImageCell.

Will take another look at it.

Re : Re : Re : Re : Re : Re : Re : Re : What is odsPhpGenerator

2010-09-14 : Rubén Caro
Can\'t dedicate more time to this, sorry. I will stick to rev24 and \'repairing\' the files when necessary, as it seems to end right after repairing.

Hope you fix this for the next rev.

Thanks !

Re : Re : Re : Re : Re : Re : Re : Re : Re : What is odsPhpGenerator

2010-09-15 : iribarren
Is there any revision that won\'t show a corrupt file if there is a image?

Re : Re : Re : Re : What is odsPhpGenerator

2012-01-16 : where we can get the code or check the fix
where can we see the submits? thanks

Re : What is odsPhpGenerator

2013-04-19 : Sphawk
Great job!
Just a question. It is possible to create a special cell with the format [HH]MM?
The [HH] syntax permit to insert hours > than 24.

Re : What is odsPhpGenerator

2014-03-04 : delaf
Hi,

I forked your project in my github account, basically because I used into my framework and I need it in github for the use with composer (what I really needed is the project in the offical repository of composer https://packagist.org/).

The url of the project in github:

https://github.com/estebandelaf/odsPhpGenerator

And the url of the project in https://packagist.org:

https://packagist.org/packages/lapinator.net/ods-php-generator

I tried to use the version 0.0.2 but I don't know why the file is corrupted when I download it. So I use a version that I modified (only to use namespaces) a time ago, but I don't know if is 0.0.1 or 0.0.2, my mistake delete the files of the version and CHANGELOG :-(

Ok, I just wanna share with you this, because its a very useful project and its part of my framework now (https://github.com/estebandelaf/mipagina).

Thanks!!

Re : Re : What is odsPhpGenerator

2014-03-13 : brinza
Hi! I added class odsDrawImage in my fork https://github.com/brinza/odsPhpGenerator.git . Now you can add image to ods.

Example:

$img = 'logo.png';
$x = '5.0cm';
$y = '5.0cm';
$width = '3.84cm';
$height = '2.17cm';

$image = new odsDrawImage($img, $x, $y, $width, $height);
$table->addDraw($image);

Re : What is odsPhpGenerator

2014-12-04 : Jarda
Hi

After using first example I am get:

Fatal error: Declaration of odsTableCellStringHttp::__construct() must be compatible with odsTableCell::__construct() in odsTableCell.php on line 98

I am using:
PHP 5.4.23 (cli) (built: Dec 11 2013 07:56:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Where is problem?

Re : What is odsPhpGenerator

2019-10-17 : Set the row height
Hello!
Can I get an example of setting the row height?

Thank!