.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Spreadsheet::ParseExcel::SaveParser 3" .TH Spreadsheet::ParseExcel::SaveParser 3 "2008-01-01" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Spreadsheet::ParseExcel::SaveParser \- Expand of Spreadsheet::ParseExcel with Spreadsheet::WriteExcel .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 16 \& #1. Write an Excel file with previous data \& use strict; \& use Spreadsheet::ParseExcel::SaveParser; \& my $oExcel = new Spreadsheet::ParseExcel::SaveParser; \& my $oBook = $oExcel->Parse('temp.xls'); \& #1.1.Update and Insert Cells \& my $iFmt = $oBook->{Worksheet}[0]->{Cells}[0][0]->{FormatNo}; \& $oBook->AddCell(0, 0, 0, 'No(UPD)', \& $oBook->{Worksheet}[0]->{Cells}[0][0]->{FormatNo}); \& $oBook->AddCell(0, 1, 0, '304', $oBook->{Worksheet}[0]->{Cells}[0][0]); \& $oBook->AddCell(0, 1, 1, 'Kawai,Takanori', $iFmt); \& #1.2.add new worksheet \& my $iWkN = $oBook->AddWorksheet('Test'); \& #1.3 Save \& $oExcel->SaveAs($oBook, 'temp.xls'); # as the same name \& $oExcel->SaveAs($oBook, 'temp1.xls'); # another name .Ve .PP .Vb 9 \& #2. Create new Excel file (most simple) \& use strict; \& use Spreadsheet::ParseExcel::SaveParser; \& my $oEx = new Spreadsheet::ParseExcel::SaveParser; \& my $oBook = $oEx->Create(); \& $oBook->AddFormat; \& $oBook->AddWorksheet('NewWS'); \& $oBook->AddCell(0, 0, 1, 'New Cell'); \& $oEx->SaveAs($oBook, 'new.xls'); .Ve .PP .Vb 26 \& #3. Create new Excel file(more complex) \& #!/usr/local/bin/perl \& use strict; \& use Spreadsheet::ParseExcel::SaveParser; \& my $oEx = new Spreadsheet::ParseExcel::SaveParser; \& my $oBook = $oEx->Create(); \& my $iF1 = $oBook->AddFont( \& Name => 'Arial', \& Height => 11, \& Bold => 1, #Bold \& Italic => 1, #Italic \& Underline => 0, \& Strikeout => 0, \& Super => 0, \& ); \& my $iFmt = \& $oBook->AddFormat( \& Font => $oBook->{Font}[$iF1], \& Fill => [1, 10, 0], # Filled with Red \& # cf. ParseExcel (@aColor) \& BdrStyle => [0, 1, 1, 0], #Border Right, Top \& BdrColor => [0, 11, 0, 0], # Right->Green \& ); \& $oBook->AddWorksheet('NewWS'); \& $oBook->AddCell(0, 0, 1, 'Cell', $iFmt); \& $oEx->SaveAs($oBook, 'new.xls'); .Ve .PP \&\fInew interface...\fR .PP .Vb 7 \& use strict; \& use Spreadsheet::ParseExcel::SaveParser; \& $oBook = \& Spreadsheet::ParseExcel::SaveParser::Workbook->Parse('Excel/Test97.xls'); \& my $oWs = $oBook->AddWorksheet('TEST1'); \& $oWs->AddCell(10, 1, 'New Cell'); \& $oBook->SaveAs('iftest.xls'); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Spreadsheet::ParseExcel::SaveParser : Expand of Spreadsheet::ParseExcel with Spreadsheet::WriteExcel .Sh "Functions" .IX Subsection "Functions" .IP "new" 4 .IX Item "new" \&\fI$oExcel\fR = new \fISpreadsheet::ParseExcel::SaveParser()\fR; .Sp Constructor. .IP "Parse" 4 .IX Item "Parse" \&\fI$oWorkbook\fR = \f(CW$oParse\fR\->Parse(\fI$sFileName\fR [, \fI$oFmt\fR]); .Sp return \*(L"Workbook\*(R" object. if error occurs, returns undef. .RS 4 .IP "\fI$sFileName\fR" 4 .IX Item "$sFileName" name of the file to parse (Same as Spreadsheet::ParseExcel) .Sp From 0.12 (with OLE::Storage_Lite v.0.06), scalar reference of file contents (ex. \e$sBuff) or IO::Handle object (inclucdng IO::File etc.) are also available. .IP "\fI$oFmt\fR" 4 .IX Item "$oFmt" Formatter Class to format the value of cells. .RE .RS 4 .RE .IP "Create" 4 .IX Item "Create" \&\fI$oWorkbook\fR = \f(CW$oParse\fR\->Create([\fI$oFmt\fR]); .Sp return new \*(L"Workbook\*(R" object. if error occurs, returns undef. .RS 4 .IP "\fI$oFmt\fR" 4 .IX Item "$oFmt" Formatter Class to format the value of cells. .RE .RS 4 .RE .IP "SaveAs" 4 .IX Item "SaveAs" \&\fI$oWorkbook\fR = \f(CW$oParse\fR\->SaveAs( \f(CW$oBook\fR, \f(CW$sName\fR); .Sp save \f(CW$oBook\fR image as an Excel file named \f(CW$sName\fR. .RS 4 .IP "\fI$oBook\fR" 4 .IX Item "$oBook" An Excel Workbook object to save. .RE .RS 4 .RE .IP "\fI$sName\fR" 4 .IX Item "$sName" Name of new Excel file. .Sh "Workbook" .IX Subsection "Workbook" \&\fISpreadsheet::ParseExcel::SaveParser::Workbook\fR .PP Workbook is a subclass of Spreadsheet::ParseExcel::Workbook. And has these methods : .IP "AddWorksheet" 4 .IX Item "AddWorksheet" \&\fI$oWorksheet\fR = \f(CW$oBook\fR\->AddWorksheet($sName, \f(CW%hProperty\fR); .Sp Create new Worksheet(Spreadsheet::ParseExcel::Worksheet). .RS 4 .IP "\fI$sName\fR" 4 .IX Item "$sName" Name of new Worksheet .IP "\fI$hProperty\fR" 4 .IX Item "$hProperty" Property of new Worksheet. .RE .RS 4 .RE .IP "AddFont" 4 .IX Item "AddFont" \&\fI$oWorksheet\fR = \f(CW$oBook\fR\->AddFont(%hProperty); .Sp Create new Font(Spreadsheet::ParseExcel::Font). .RS 4 .IP "\fI$hProperty\fR" 4 .IX Item "$hProperty" Property of new Worksheet. .RE .RS 4 .RE .IP "AddFormat" 4 .IX Item "AddFormat" \&\fI$oWorksheet\fR = \f(CW$oBook\fR\->AddFormat(%hProperty); .Sp Create new Format(Spreadsheet::ParseExcel::Format). .RS 4 .IP "\fI$hProperty\fR" 4 .IX Item "$hProperty" Property of new Format. .RE .RS 4 .RE .IP "AddCell" 4 .IX Item "AddCell" \&\fI$oWorksheet\fR = \f(CW$oBook\fR\->AddCell($iWorksheet, \f(CW$iRow\fR, \f(CW$iCol\fR, \f(CW$sVal\fR, \f(CW$iFormat\fR [, \f(CW$sCode\fR]); .Sp Create new Cell(Spreadsheet::ParseExcel::Cell). .RS 4 .IP "\fI$iWorksheet\fR" 4 .IX Item "$iWorksheet" Number of Worksheet .RE .RS 4 .IP "\fI$iRow\fR" 4 .IX Item "$iRow" Number of row .RE .RS 4 .IP "\fI$sVal\fR" 4 .IX Item "$sVal" Value of the cell. .RE .RS 4 .IP "\fI$iFormat\fR" 4 .IX Item "$iFormat" Number of format for use. To specify just same as another cell, you can set it like below: .Sp ex. .Sp .Vb 4 \& $oCell=$oWorksheet->{Cells}[0][0]; #Just a sample \& $oBook->AddCell(0, 1, 0, 'New One', $oCell->{FormatNo}); \& #or \& $oBook->AddCell(0, 1, 0, 'New One', $oCell); .Ve .RE .RS 4 .IP "\fI$sCode\fR" 4 .IX Item "$sCode" .Vb 1 \& Character code .Ve .RE .RS 4 .RE .Sh "Worksheet" .IX Subsection "Worksheet" \&\fISpreadsheet::ParseExcel::SaveParser::Worksheet\fR .PP Worksheet is a subclass of Spreadsheet::ParseExcel::Worksheet. And has these methods : .IP "AddCell" 4 .IX Item "AddCell" \&\fI$oWorksheet\fR = \f(CW$oWkSheet\fR\->AddCell($iRow, \f(CW$iCol\fR, \f(CW$sVal\fR, \f(CW$iFormat\fR [, \f(CW$sCode\fR]); .Sp Create new Cell(Spreadsheet::ParseExcel::Cell). .RS 4 .IP "\fI$iRow\fR" 4 .IX Item "$iRow" Number of row .RE .RS 4 .IP "\fI$sVal\fR" 4 .IX Item "$sVal" Value of the cell. .RE .RS 4 .IP "\fI$iFormat\fR" 4 .IX Item "$iFormat" Number of format for use. To specify just same as another cell, you can set it like below: .Sp ex. .Sp .Vb 4 \& $oCell=$oWorksheet->{Cells}[0][0]; #Just a sample \& $oWorksheet->AddCell(1, 0, 'New One', $oCell->{FormatNo}); \& #or \& $oWorksheet->AddCell(1, 0, 'New One', $oCell); .Ve .RE .RS 4 .IP "\fI$sCode\fR" 4 .IX Item "$sCode" .Vb 1 \& Character code .Ve .RE .RS 4 .RE .SH "MORE INFORMATION" .IX Header "MORE INFORMATION" Please visit my Wiki page. I'll add sample at : http://www.hippo2000.info/cgi\-bin/KbWikiE/KbWiki.pl .SH "Known Problem" .IX Header "Known Problem" \&\-Only last print area will remain. (Others will be removed) .SH "AUTHOR" .IX Header "AUTHOR" Kawai Takanori (Hippo2000) kwitknr@cpan.org .PP .Vb 2 \& http://member.nifty.ne.jp/hippo2000/ (Japanese) \& http://member.nifty.ne.jp/hippo2000/index_e.htm (English) .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1XLHTML\s0, OLE::Storage, Spreadsheet::WriteExcel, OLE::Storage_Lite .PP This module is based on herbert within OLE::Storage and \s-1XLHTML\s0. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2000\-2002 Kawai Takanori and Nippon-RAD Co. \s-1OP\s0 Division All rights reserved. .PP 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. .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" First of all, I would like to acknowledge valuable program and modules : \&\s-1XHTML\s0, OLE::Storage and Spreadsheet::WriteExcel. .PP In no particular order: Yamaji Haruna, Simamoto Takesi, Noguchi Harumi, Ikezawa Kazuhiro, Suwazono Shugo, Hirofumi Morisada, Michael Edwards, Kim Namusk and many many people + Kawai Mikako.