1

1 つの ODF ファイルから別の ODF ファイルに 1 つのシートをコピーするのは簡単だと思います。残念ながら、以下の最も単純なコードでさえ、空の新しいファイルで終わります:

#!/usr/bin/env perl

use strict; use warnings; use 5.014; use utf8::all;
use ODF::lpOD;

my $doc = odf_get_document( "olddoc.ods" )
  or die "Failed to load the document\n";

my $table = $doc->get_body->get_table_by_position(0);

my $newdoc = odf_new_document('spreadsheet');
my $context = $newdoc->get_body;
my $newtable = $context->insert_element( $table );

$newdoc->save(target => "newdoc.ods");

私が見る唯一の出力はですElement already belonging to a tree

古いドキュメントの最初のシートで新しいドキュメントを作成できない理由がわかりますか?

4

0 に答える 0