=?ISO-8859-15?Q?Jean-Marie_Gouarn=E9?=
Usenet Archive
- Joined
- Aug 5, 2004
- Messages
- 1
- Reaction score
- 0
The new OpenOffice::OODoc distribution, V 1.203, is available from CPAN today.
It's an Expat-based Perl extension allowing direct read/write access to OpenOffice.org (XML) documents. It provides an object representation of the OOo documents, with a lot of methods to get, create, update or delete any content or presentation element, and attempts to hide the most part of the complex XPath navigation. This toobox is an XML API that deal with the physical files (compressed XML), and never uses the OpenOffice.org (or StarOffice) product. It allows document processing where no desktop software is installed, and requires a Perl 5.8 environment only (so the same scripts can be deployed on Win32, Linux, Solaris, HP-UX, Mac and other platforms).
The most recent new features are:
- While the previous releases allowed only read/write operations in previously existing documents, the present one can create new OOo documents from scratch; the user has just to provide an additional "create" option giving the document class in the main object constructor. For ex, to create a new spreadsheet (i.e. OpenOffice Calc) document that will be stored in a "doc.sxc" file, the constructor is:
my $doc = ooDocument
(
file => "doc.sxc",
create => "spreadsheet"
);
The new documents are generated from a set of XML templates; if needed, each application can select user-provided templates instead of the default ones
- The createImageElement method has been improved to allow easy image import in drawing and presentation documents as well as in text or spreadsheet documents. Ex:
$doc->createImageElement
(
"Mountain",
description => "The Kilimanjaro",
page => 3,
position => "4.2cm, 5cm"
size => "3cm, 4cm",
style => "MyGraphics",
import => "C:\MyImages\Mountain.jpg"
);
- The OOo date fields (stored in ISO-8601 format) can be easily translated to/from Perl localtime dates, due to new conversion functions;
- Symbolic color names (like "blue" or "yellow") and not only raw hexadecimal RGB codes, are allowed for text and background colors. So, to color in dark blue with a yellow background every paragraph or item matching "OpenOffice" (or any other string or regex), the code is more readable:
# define the colored style
$doc->createTextStyle
(
"Outstanding",
properties =>
{
'fo:color' => rgb2oo("dark blue"),
'fo:background-color' => rgb2oo("yellow")
}
);
# give the colored style to the selected elements
$doc->setStyle($_, "Outstanding")
for $doc->selectElementsByContent("OpenOffice");
- Bug fixes and functional improvements in the localization; the local character sets seems to be properly supported; the user's local character (iso-8859-1 by default) can be selected either at the installation level or separately in each application.
The previous text-focused methods (search/replace/create/remove) are unchanged.
Please see http://search.cpan.org/dist/OpenOffice-OODoc for details
Thanks for comments
JMG http://jean.marie.gouarne.online.fr
It's an Expat-based Perl extension allowing direct read/write access to OpenOffice.org (XML) documents. It provides an object representation of the OOo documents, with a lot of methods to get, create, update or delete any content or presentation element, and attempts to hide the most part of the complex XPath navigation. This toobox is an XML API that deal with the physical files (compressed XML), and never uses the OpenOffice.org (or StarOffice) product. It allows document processing where no desktop software is installed, and requires a Perl 5.8 environment only (so the same scripts can be deployed on Win32, Linux, Solaris, HP-UX, Mac and other platforms).
The most recent new features are:
- While the previous releases allowed only read/write operations in previously existing documents, the present one can create new OOo documents from scratch; the user has just to provide an additional "create" option giving the document class in the main object constructor. For ex, to create a new spreadsheet (i.e. OpenOffice Calc) document that will be stored in a "doc.sxc" file, the constructor is:
my $doc = ooDocument
(
file => "doc.sxc",
create => "spreadsheet"
);
The new documents are generated from a set of XML templates; if needed, each application can select user-provided templates instead of the default ones
- The createImageElement method has been improved to allow easy image import in drawing and presentation documents as well as in text or spreadsheet documents. Ex:
$doc->createImageElement
(
"Mountain",
description => "The Kilimanjaro",
page => 3,
position => "4.2cm, 5cm"
size => "3cm, 4cm",
style => "MyGraphics",
import => "C:\MyImages\Mountain.jpg"
);
- The OOo date fields (stored in ISO-8601 format) can be easily translated to/from Perl localtime dates, due to new conversion functions;
- Symbolic color names (like "blue" or "yellow") and not only raw hexadecimal RGB codes, are allowed for text and background colors. So, to color in dark blue with a yellow background every paragraph or item matching "OpenOffice" (or any other string or regex), the code is more readable:
# define the colored style
$doc->createTextStyle
(
"Outstanding",
properties =>
{
'fo:color' => rgb2oo("dark blue"),
'fo:background-color' => rgb2oo("yellow")
}
);
# give the colored style to the selected elements
$doc->setStyle($_, "Outstanding")
for $doc->selectElementsByContent("OpenOffice");
- Bug fixes and functional improvements in the localization; the local character sets seems to be properly supported; the user's local character (iso-8859-1 by default) can be selected either at the installation level or separately in each application.
The previous text-focused methods (search/replace/create/remove) are unchanged.
Please see http://search.cpan.org/dist/OpenOffice-OODoc for details
Thanks for comments
JMG http://jean.marie.gouarne.online.fr