LINUX.ORG.RU

История изменений

Исправление futurama, (текущая версия) :

создать ods не сложно. этот код урезан, т.к. в реальном скрипте много кода для парсинга входного файла, по данным которого строится ods


#!/usr/bin/perl

use OpenOffice::OODoc;


#create the OOo spreadsheet
my $doc = odfDocument(file => $output_file, create => 'spreadsheet');

# select & size the 1st (and only) sheet in the document
my $sheet = $doc->expandTable(0, $lines, $columns);
# rename 
$doc->renameTable($sheet, 'drl count');

$doc->autoSheetNormalizationOn('full');

$doc->createStyle (
        "3cm",
        family => 'table-column',
        parent => 'Standard',
        properties   => {
            'style:column-width' => "3cm"
        }
);


while ($line = <INPUT>) {
	...
	$doc->cellValue($cells[$j], shift @cellvalues);
        ...
    }
	for (my $j = 0 ; $j < 10 ; $j++) {
        $doc->style($cells[$j], 'myborders');
    }
    $i++;
}

# save the result
$doc->save;

Исправление futurama, :

создать ods не сложно. этот код урезан, т.к. в реальном скрипте много кода для парсинга входного файла, по данным которого строится ods


#!/usr/bin/perl

use OpenOffice::OODoc;


create the OOo spreadsheet
my $doc = odfDocument(file => $output_file, create => 'spreadsheet');

# select & size the 1st (and only) sheet in the document
my $sheet = $doc->expandTable(0, $lines, $columns);
# rename 
$doc->renameTable($sheet, 'drl count');

$doc->autoSheetNormalizationOn('full');

$doc->createStyle (
        "3cm",
        family => 'table-column',
        parent => 'Standard',
        properties   => {
            'style:column-width' => "3cm"
        }
);


while ($line = <INPUT>) {
	...
	$doc->cellValue($cells[$j], shift @cellvalues);
        ...
    }
	for (my $j = 0 ; $j < 10 ; $j++) {
        $doc->style($cells[$j], 'myborders');
    }
    $i++;
}

# save the result
$doc->save;

Исходная версия futurama, :


#!/usr/bin/perl

use OpenOffice::OODoc;


create the OOo spreadsheet
my $doc = odfDocument(file => $output_file, create => 'spreadsheet');

# select & size the 1st (and only) sheet in the document
my $sheet = $doc->expandTable(0, $lines, $columns);
# rename 
$doc->renameTable($sheet, 'drl count');

$doc->autoSheetNormalizationOn('full');

$doc->createStyle (
        "3cm",
        family => 'table-column',
        parent => 'Standard',
        properties   => {
            'style:column-width' => "3cm"
        }
);


while ($line = <INPUT>) {
	...
	$doc->cellValue($cells[$j], shift @cellvalues);
        ...
    }
	for (my $j = 0 ; $j < 10 ; $j++) {
        $doc->style($cells[$j], 'myborders');
    }
    $i++;
}

# save the result
$doc->save;