http://www.perlmonks.org?node_id=868874

dallen16 has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone been able to write Perl scripts with Win32::OLE that create well formatted, non-trivial spreadsheets using OpenOffice.org or derivatives such as Lotus Symphony 3? ... or by any other means?

I have years of experience creating "all sorts" of complex MS Excel spreadsheets using ActiveState Perl, Win32::OLE and the MS Excel object model. I've been "challenged" to migrate some of this work to OpenOffice 3.x. My initial impression is that it's much more complicated with OpenOffice than with MS Excel. And even some of the basics don't seem to work... like setting the visible / hidden parameter on file open call as such... (or maybe I'm just being dense). Conversely, setting Excel to invisible is commonplace and trivial.

Anyone want to collaborate on developing and posting non-trivial Perl scripts that create and manipulate OpenOffice spreadsheets?

use strict; use warnings; use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const; Win32::OLE->Option(Warn => 3); # Turn on warnings for easier debugging my $objServiceManager = Win32::OLE->new("com.sun.star.ServiceManager") + || die "CreateObject: $!"; # create a new process my $desktop = $objServiceManager->createInstance("com.sun.star.frame.D +esktop"); my @propValue = (); $propValue[0] = $objServiceManager->Bridge_GetStruct("com.sun.star.bea +ns.PropertyValue"); $propValue[0]->{Name} = 'Hidden'; # This does not work! $propValue[0]->{Value} = 1; my $calc = $desktop->loadComponentfromUrl("file:///C:/My Documents/Sum +mary-20101031.ods", "MyCalc", 0, \@propValue );