Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   OpenOffice Spreadsheet (http://www.velocityreviews.com/forums/t908934-openoffice-spreadsheet.html)

Grehom 11-17-2008 06:58 PM

OpenOffice Spreadsheet
 
I'm just trying to read a column in a spreadsheet and create a new
value in a new column to right of the others.
I tried with the following, but it doesn't create the new column, any
hints please

use OpenOffice::OODoc;
my $doc = odfDocument(file => 'iwm.ods');

$row = 3;
while ( my $cli = $doc->cellValue(0, "D$row") ) {
my $username = get_customer_account( $dbh, $cli );
print "$cli => $username\n";
$doc->cellValue(0, "E$row", $username);
$row++;
}

$doc->save();


It's reading the spreadsheet fine, but it's not inserting the new
value into 'E' column

Chris Haffenstedt 11-18-2008 11:41 AM

Re: OpenOffice Spreadsheet
 
Grehom schrieb:
> I'm just trying to read a column in a spreadsheet and create a new
> value in a new column to right of the others.
> I tried with the following, but it doesn't create the new column, any
> hints please
>
> use OpenOffice::OODoc;
> my $doc = odfDocument(file => 'iwm.ods');
>
> $row = 3;
> while ( my $cli = $doc->cellValue(0, "D$row") ) {
> my $username = get_customer_account( $dbh, $cli );
> print "$cli => $username\n";
> $doc->cellValue(0, "E$row", $username);
> $row++;
> }
>
> $doc->save();
>
>
> It's reading the spreadsheet fine, but it's not inserting the new
> value into 'E' column


Try
$doc->updateCell(0, "E$row", $username);

Grehom 11-20-2008 08:34 AM

Re: OpenOffice Spreadsheet
 
On Nov 18, 11:41*am, Chris Haffenstedt <ch...@t-online.de> wrote:
> Grehomschrieb:
>
>
>
> > I'm just trying to read a column in a spreadsheet and create a new
> > value in a new column to right of the others.
> > I tried with the following, but it doesn't create the new column, any
> > hints please

>
> > use OpenOffice::OODoc;
> > my $doc = odfDocument(file => 'iwm.ods');

>
> > $row = 3;
> > while ( my $cli = $doc->cellValue(0, "D$row") ) {
> > * * my $username = get_customer_account( $dbh, $cli );
> > * * print "$cli => $username\n";
> > * * $doc->cellValue(0, "E$row", $username);
> > * * $row++;
> > }

>
> > $doc->save();

>
> > It's reading the spreadsheet fine, but it's not inserting the new
> > value into 'E' column

>
> Try
> $doc->updateCell(0, "E$row", $username);


Thanks, but I had already tried that, the problem I think is that
the table (0) I want to insert a fifth column into is only 4 columns
wide (when I open the spreadsheet you can see bold black outline
around the overall table size), I tried expanding the table but that
only seemed to widen the very last line of the table. I guess I
should just write a brand new table based on the old table and
delete the old table, but that seems rather crude.


All times are GMT. The time now is 12:35 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.