0

PerlでOpenOffice::OODocモジュールを使用してセルにスタイルを適用するにはどうすればよいですか?

私は試した:

my $container = odfContainer("report1.ods", create => 'spreadsheet');

my $doc = odfDocument (
                       container => $container,
                       part      => 'content'
                      );

# Styles
my $styles = odfDocument (
                       container => $container,
                       part      => 'styles'
                      );

$styles->createStyle ('TTT',
        family       => 'cell',
        display-name => 'Table Headers',
        properties   => {
            'fo:font-weight' => 'bold',
            'fo:color'       => '#ffffff',
        }
);

{
    for (my $x = 0; $x < $X; $x++) {
        $doc->columnStyle ($sheet, $x, "TTT"); # does not work
        for (my $y = 0; $y < $Y; $y++) {
            my $cell = $doc->getTableCell ($sheet, $y, $x);
            $doc->cellValueType ($cell, $headers->[$x][1]);
            $doc->updateCell ($cell, $data->[$y][$x]);
            $doc->setStyle ($cell, 'TTT'); # does not work
            $doc->cellStyle ($cell, 'TTT'); # does not work
        }
    }
}
4

1 に答える 1

1

スタイルを参照してください:

style(object [, style])

テキストまたはグラフィックスオブジェクトのスタイル名を返します。最初の引数が「マスターページ」(OODoc :: Stylesを参照)の場合、関連する「ページレイアウト」も返します。

2番目の引数としてスタイル名が指定されている場合は、オブジェクトのスタイルを置き換えます。

于 2010-08-13T15:26:02.363 に答える