# phpman > man > OLE::Storage_Lite

## NAME
    [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown) - Simple Class for OLE document interface.

## SYNOPSIS
        use [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown);

        # Initialize.

        # From a file
        my $oOl = [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown)->new("some.xls");

        # From a filehandle object
        use [IO::File](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3AFile/markdown);
        my $oIo = new [IO::File](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3AFile/markdown);
        $oIo->open("<iofile.xls");
        binmode($oIo);
        my $oOl = [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown)->new($oFile);

        # Read data
        my $oPps = $oOl->[getPpsTree(1)](https://www.chedong.com/phpMan.php/man/getPpsTree/1/markdown);

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

        # To a filehandle object
        my $oIo = new [IO::File](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3AFile/markdown);
        $oIo->open(">iofile.xls");
        bimode($oIo);
        $oPps->save($oIo);

## DESCRIPTION
    [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown) allows you to read and write an OLE structured file.

    [OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown) is a class representing PPS. [OLE::Storage_Lite::PPS::Root](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ARoot/markdown),
    [OLE::Storage_Lite::PPS::File](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3AFile/markdown) and [OLE::Storage_Lite::PPS::Dir](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ADir/markdown) are subclasses of
    [OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown).

  new()
    Constructor.

        $oOle = [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown)->new($sFile);

    Creates a [OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown) object for $sFile. $sFile must be a correct file name.

    The "new()" constructor also accepts a valid filehandle. Remember to "binmode()" the filehandle
    first.

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

    Returns PPS as an [OLE::Storage_Lite::PPS::Root](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ARoot/markdown) object. Other PPS objects will be included as its
    children.

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

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

    Returns PPSs as [OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown) 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.

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

    Returns PPS as "[OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown)" object specified number $iNth.

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

  Asc2Ucs()
        $sUcs2 = [OLE::Storage_Lite::Asc2Ucs](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3AAsc2Ucs/markdown)($sAsc>);

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

  Ucs2Asc()
        $sAsc = [OLE::Storage_Lite::Ucs2Asc](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3AUcs2Asc/markdown)($sUcs2);

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

[OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown)
    [OLE::Storage_Lite::PPS](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS/markdown) has these properties:

    No  Order number in saving.

    Name
        Its name in UCS2 (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 format of localtime.

    Time2nd
        Timestamp 2nd in array ref as similar format 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](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ARoot/markdown)
    [OLE::Storage_Lite::PPS::Root](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ARoot/markdown) has 2 methods.

  new()
        $oRoot = [OLE::Storage_Lite::PPS::Root](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ARoot/markdown)->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.

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

    Saves information into $sFile. If $sFile is '-', this will use STDOUT.

    The "new()" constructor also accepts a valid filehandle. Remember to "binmode()" 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 PPS saving order.

[OLE::Storage_Lite::PPS::Dir](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ADir/markdown)
    [OLE::Storage_Lite::PPS::Dir](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ADir/markdown) has 1 method.

  new()
        $oRoot = [OLE::Storage_Lite::PPS::Dir](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3ADir/markdown)->new(
                        $sName,
                      [, $raTime1st]
                      [, $raTime2nd]
                      [, $raChild>]);

    Constructor.

    $sName is a name of the PPS.

    $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](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3AFile/markdown)
    [OLE::Storage_Lite::PPS::File](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3AFile/markdown) has 3 method.

  new
        $oRoot = [OLE::Storage_Lite::PPS::File](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3AFile/markdown)->new($sName, $sData);

    $sName is name of the PPS.

    $sData is data of the PPS.

  newFile()
        $oRoot = [OLE::Storage_Lite::PPS::File](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite%3A%3APPS%3A%3AFile/markdown)->newFile($sName, $sFile);

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

    $sName is name of the PPS.

    If $sFile is scalar, it assumes that is a filename. If $sFile is an [IO::Handle](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3AHandle/markdown) object, it uses
    that specified handle. If $sFile is undef or '', it uses temporary file.

    CAUTION: Take care $sFile will be updated by "append" method. So if you want to use [IO::Handle](https://www.chedong.com/phpMan.php/perldoc/IO%3A%3AHandle/markdown)
    and append a data to it, you should open the handle with "r+".

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

    appends specified data to that PPS.

    $sData is appending data for that PPS.

## CAUTION
    A saved file with VBA (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 "[OLE::Storage_Lite](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown)" autovivified a scalar ref in the "new()" 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](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorageLite/markdown) module is Copyright (c) 2000,2001 Kawai Takanori. Japan. All rights
    reserved.

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

## ACKNOWLEDGEMENTS
    First of all, I would like to acknowledge to Martin Schwartz and his module [OLE::Storage](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorage/markdown).

## AUTHOR
    Kawai Takanori <kwitknr@cpan.org>

    This module is currently maintained by John McNamara <jmcnamara@cpan.org>

## SEE ALSO
    [OLE::Storage](https://www.chedong.com/phpMan.php/perldoc/OLE%3A%3AStorage/markdown)

    Documentation for the OLE 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 OLE format in the JPEG2000 specification: see
    Appendix A of <http://www.i3a.org/pdf/wg1n1017.pdf>

