Thread

Posted on Fri Nov 17 05:15:28 2006 by pnb
Simple question on generating a filename or title for an OOo document
Hello, I was most delighted to come accross the OpenOffice::OODoc module and I am using it to produce billing statements for information queried from a Perl::DBI database, great stuff....
My problem is that when I store my OODoc document with a filename like "Taylor.odt" it has the right filename on the harddrive but when the document opens in OpenOffice it's title is "Untitled". I've read through the man pages about the OODoc::Meta module but haven't gotten anywhere yet so I thought I would try here. How does one set the documents title or name?
I am creating a document from a template (.ott) file (basicaly just a letterhead with the date) and then saving it using the billed parties name as the filename.
Here are is my code:
use OpenOffice::OODoc; my $document = ooDocument(file=>'/home/pnb/DRC-07/Billing/Receipts/letterhead.ott'); ... (mostly $document->appendParagraph statements) ... my $statement = "/home/pnb/temp/$BusinessOrLastName.odt"; $document->save($statement);

Any help would be most appreciated. Thanks, Paul
Direct Responses: 3568 | Write a response
Posted on Fri Nov 17 13:18:36 2006 by jmgdoc in response to 3566
Re: Simple question on generating a filename or title for an OOo document
In order to set the title of an already open document connector, we must get a metadata connector then the title() method, like that:
my $document = ooDocument(file => ...); #... my $meta = ooMeta(file => $document); $meta->title("My title"); #... $document->save("target_file.odt");
Direct Responses: 3574 | Write a response
Posted on Fri Nov 17 21:26:49 2006 by pnb in response to 3568
Re: Simple question on generating a filename or title for an OOo document
I have tried your example but it is still not working, the saved document still has "Untitled" as it's title. Is it that I am starting with one document ".../letterhead.ott" which has "Untitled" as it's title and them I am saving it under a different filename like ".../Berry.odt"? Does it make any difference to change the meta data at the beginning of my subroutine or at the end, just before saving the document?
Thanks for your help.
Direct Responses: 3579 | Write a response
Posted on Sun Nov 19 12:46:44 2006 by jmgdoc in response to 3574
Re: Simple question on generating a filename or title for an OOo document
There is no link between the filename and the title.
So, as long as the title is not expressly changed by the application, it remains the same, whatever the filename.
On the other hand, changing the title at the beginning or at the end doesn't matter.
Write a response