Skip Menu |

This queue is for tickets about the ODF-lpOD CPAN distribution.

Report information
The Basics
Id: 75515
Status: resolved
Priority: 0/
Queue: ODF-lpOD

People
Owner: Nobody in particular
Requestors: DJIBEL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 1.118
  • 1.119
Fixed in: 1.120



Subject: Bug : User field (set_field, set_variable)
Dear, I am using Perl 5.14 on Win XP, Win Vista... and I have ODF::lpOD 1.118 or 1.119. The set_field and set_variable does not work and print and error message : Unknown object insertion context. That is my program : #!/usr/bin/perl use strict; use warnings; use ODF::lpOD; my $document = odf_document->create('text'); my $context = $document->get_body; my $paragraph = odf_paragraph->create(text => 'My name is '); $context->insert_element($paragraph); $document->set_variable('Client', type => 'string', value => 'djibel'); $paragraph->set_field('variable', name => 'Client', after => 'My name is '); $document->save(target => 'UserFieldFile.odt'); I have try to replace $paragraph ->set_field('variable', name => 'Client', after => 'My name is '); by $par->set_field('variable', name => 'Client', offset => 'end'); But I have the same error message. Best Regards, djibel
Should be fixed in 1.120, coming soon.

Up to 1.119, set_variable() fails to create the first variable in a document, so it always fails in a newly created document; it works properly with documents containing one or more previously defined variables.

On 2012-03-04 03:59:18, DJIBEL wrote :
Show quoted text
> Dear,
>
> I am using Perl 5.14 on Win XP, Win Vista... and I have ODF::lpOD 1.118
> or 1.119.
> The set_field and set_variable does not work and print and error message
> : Unknown object insertion context.
>
> That is my program :
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use ODF::lpOD;
>
> my $document = odf_document->create('text');
> my $context = $document->get_body;
>
> my $paragraph = odf_paragraph->create(text => 'My name is ');
> $context->insert_element($paragraph);
>
> $document->set_variable('Client', type => 'string', value => 'djibel');
> $paragraph->set_field('variable', name => 'Client', after => 'My name is ');
>
> $document->save(target => 'UserFieldFile.odt');
>
> I have try to replace $paragraph ->set_field('variable', name =>
> 'Client', after => 'My name is ');
>
> by
>
> $par->set_field('variable', name => 'Client', offset => 'end');
>
> But I have the same error message.
>
> Best Regards,
>
> djibel