1

认为将一张从一个 ODF 文件复制到另一张是小菜一碟。不幸的是,即使是下面最简单的代码也以空的新文件结尾:

#!/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