SYNOPSIS

    use OLE::Storage_Lite;

    # Initialize.

    # From a file
    my $oOl = OLE::Storage_Lite->new("some.xls");

    # From a filehandle object
    use IO::File;
    my $oIo = new IO::File;
    $oIo->open("<iofile.xls");
    binmode($oIo);
    my $oOl = OLE::Storage_Lite->new($oFile);

    # Read data
    my $oPps = $oOl->getPpsTree(1);

    # Save Data
    # To a File
    $oPps->save("kaba.xls"); #kaba.xls
    $oPps->save('-');        #STDOUT

    # To a filehandle object
    my $oIo = new IO::File;
    $oIo->open(">iofile.xls");
    bimode($oIo);
    $oPps->save($oIo);

DESCRIPTION

OLE::Storage_Lite allows you to read and write an \s-1OLE\s0 structured file.

OLE::Storage_Lite::PPS is a class representing \s-1PPS\s0. OLE::Storage_Lite::PPS::Root, OLE::Storage_Lite::PPS::File and OLE::Storage_Lite::PPS::Dir are subclasses of OLE::Storage_Lite::PPS.

\fInew()\fP

Constructor.

$oOle = OLE::Storage_Lite->new($sFile);

Creates a OLE::Storage_Lite object for $sFile. $sFile must be a correct file name.

The \*(C`new()\*(C' constructor also accepts a valid filehandle. Remember to \*(C`binmode()\*(C' the filehandle first.

\fIgetPpsTree()\fP

$oPpsRoot = $oOle->getPpsTree([$bData]);

Returns \s-1PPS\s0 as an OLE::Storage_Lite::PPS::Root object. Other \s-1PPS\s0 objects will be included as its children.

If $bData is true, the objects will have data in the file.

\fIgetPpsSearch()\fP

$oPpsRoot = $oOle->getPpsTree($raName [, $bData][, $iCase] );

Returns PPSs as OLE::Storage_Lite::PPS objects that has the name specified in $raName array.

If $bData is true, the objects will have data in the file. If $iCase is true, search is case insensitive.

\fIgetNthPps()\fP

$oPpsRoot = $oOle->getNthPps($iNth [, $bData]);

Returns \s-1PPS\s0 as \*(C`OLE::Storage_Lite::PPS\*(C' object specified number $iNth.

If $bData is true, the objects will have data in the file.

\fIAsc2Ucs()\fP

$sUcs2 = OLE::Storage_Lite::Asc2Ucs($sAsc>);

Utility function. Just adds 0x00 after every characters in $sAsc.

\fIUcs2Asc()\fP

$sAsc = OLE::Storage_Lite::Ucs2Asc($sUcs2);

Utility function. Just deletes 0x00 after words in $sUcs.

OLE::Storage_Lite::PPS

OLE::Storage_Lite::PPS has these properties:

No

Order number in saving.

Name

Its name in \s-1UCS2\s0 (a.k.a Unicode).

Type

Its type (1:Dir, 2:File (Data), 5: Root)

PrevPps

Previous pps (as No)

NextPps

Next pps (as No)

DirPps

Dir pps (as No).

Time1st

Timestamp 1st in array ref as similar fomat of localtime.

Time2nd

Timestamp 2nd in array ref as similar fomat of localtime.

StartBlock

Start block number

Size

Size of the pps

Data

Its data

Child

Its child PPSs in array ref

OLE::Storage_Lite::PPS::Root

OLE::Storage_Lite::PPS::Root has 2 methods.

\fInew()\fP

$oRoot = OLE::Storage_Lite::PPS::Root->new( $raTime1st, $raTime2nd, $raChild);

Constructor.

$raTime1st, $raTime2nd are array refs with ($iSec, $iMin, $iHour, $iDay, $iMon, $iYear). $iSec means seconds, $iMin means minutes. $iHour means hours. $iDay means day. $iMon is month -1. $iYear is year - 1900.

$raChild is a array ref of children PPSs.

\fIsave()\fP

$oRoot = $oRoot>->save( $sFile, $bNoAs);

Saves information into $sFile. If $sFile is '-', this will use \s-1STDOUT\s0.

The \*(C`new()\*(C' constructor also accepts a valid filehandle. Remember to \*(C`binmode()\*(C' the filehandle first.

If $bNoAs is defined, this function will use the No of PPSs for saving order. If $bNoAs is undefined, this will calculate \s-1PPS\s0 saving order.

OLE::Storage_Lite::PPS::Dir

OLE::Storage_Lite::PPS::Dir has 1 method.

\fInew()\fP

$oRoot = OLE::Storage_Lite::PPS::Dir->new( $sName, [, $raTime1st] [, $raTime2nd] [, $raChild>]);

Constructor.

$sName is a name of the \s-1PPS\s0.

$raTime1st, $raTime2nd is a array ref as ($iSec, $iMin, $iHour, $iDay, $iMon, $iYear). $iSec means seconds, $iMin means minutes. $iHour means hours. $iDay means day. $iMon is month -1. $iYear is year - 1900.

$raChild is a array ref of children PPSs.

OLE::Storage_Lite::PPS::File

OLE::Storage_Lite::PPS::File has 3 method.

new

$oRoot = OLE::Storage_Lite::PPS::File->new($sName, $sData);

$sName is name of the \s-1PPS\s0.

$sData is data of the \s-1PPS\s0.

\fInewFile()\fP

$oRoot = OLE::Storage_Lite::PPS::File->newFile($sName, $sFile);

This function makes to use file handle for geting and storing data.

$sName is name of the \s-1PPS\s0.

If $sFile is scalar, it assumes that is a filename. If $sFile is an IO::Handle object, it uses that specified handle. If $sFile is undef or '', it uses temporary file.

\s-1CAUTION:\s0 Take care $sFile will be updated by \*(C`append\*(C' method. So if you want to use IO::Handle and append a data to it, you should open the handle with \*(L"r+\*(R".

\fIappend()\fP

$oRoot = $oPps->append($sData);

appends specified data to that \s-1PPS\s0.

$sData is appending data for that \s-1PPS\s0.

CAUTION

A saved file with \s-1VBA\s0 (a.k.a Macros) by this module will not work correctly. However modules can get the same information from the file, the file occurs a error in application(Word, Excel ...).

DEPRECATED FEATURES

Older version of \*(C`OLE::Storage_Lite\*(C' autovivified a scalar ref in the \*(C`new()\*(C' constructors into a scalar filehandle. This functionality is still there for backwards compatibility but it is highly recommended that you do not use it. Instead create a filehandle (scalar or otherwise) and pass that in.

COPYRIGHT

The OLE::Storage_Lite module is Copyright (c) 2000,2001 Kawai Takanori. Japan. All rights reserved.

You may distribute under the terms of either the \s-1GNU\s0 General Public License or the Artistic License, as specified in the Perl \s-1README\s0 file.

ACKNOWLEDGEMENTS

First of all, I would like to acknowledge to Martin Schwartz and his module OLE::Storage.

AUTHOR

Kawai Takanori [email protected]

This module is currently maintained by John McNamara [email protected]

RELATED TO OLE::Storage_Lite…

OLE::Storage

Documentation for the \s-1OLE\s0 Compound document has been released by Microsoft under the Open Specification Promise. See http://www.microsoft.com/interop/docs/supportingtechnologies.mspx

The Digital Imaging Group have also detailed the \s-1OLE\s0 format in the \s-1JPEG2000\s0 specification: see Appendix A of http://www.i3a.org/pdf/wg1n1017.pdf