1Spreadsheet::ParseExcelU:s:eSravCeoPnatrrsiebru(t3e)d PeSrplreDaodcsuhmeeentt:a:tPiaornseExcel::SaveParser(3)
2
3
4

NAME

6       Spreadsheet::ParseExcel::SaveParser - Expand of Spreadsheet::ParseExcel
7       with Spreadsheet::WriteExcel
8

SYNOPSIS

10           #1. Write an Excel file with previous data
11           use strict;
12           use Spreadsheet::ParseExcel::SaveParser;
13           my $oExcel = new Spreadsheet::ParseExcel::SaveParser;
14           my $oBook = $oExcel->Parse('temp.xls');
15           #1.1.Update and Insert Cells
16           my $iFmt = $oBook->{Worksheet}[0]->{Cells}[0][0]->{FormatNo};
17           $oBook->AddCell(0, 0, 0, 'No(UPD)',
18               $oBook->{Worksheet}[0]->{Cells}[0][0]->{FormatNo});
19           $oBook->AddCell(0, 1, 0, '304', $oBook->{Worksheet}[0]->{Cells}[0][0]);
20           $oBook->AddCell(0, 1, 1, 'Kawai,Takanori', $iFmt);
21           #1.2.add new worksheet
22           my $iWkN = $oBook->AddWorksheet('Test');
23           #1.3 Save
24           $oExcel->SaveAs($oBook, 'temp.xls');  # as the same name
25           $oExcel->SaveAs($oBook, 'temp1.xls'); # another name
26
27           #2. Create new Excel file (most simple)
28           use strict;
29           use Spreadsheet::ParseExcel::SaveParser;
30           my $oEx = new Spreadsheet::ParseExcel::SaveParser;
31           my $oBook = $oEx->Create();
32           $oBook->AddFormat;
33           $oBook->AddWorksheet('NewWS');
34           $oBook->AddCell(0, 0, 1, 'New Cell');
35           $oEx->SaveAs($oBook, 'new.xls');
36
37           #3. Create new Excel file(more complex)
38           #!/usr/local/bin/perl
39           use strict;
40           use Spreadsheet::ParseExcel::SaveParser;
41           my $oEx = new Spreadsheet::ParseExcel::SaveParser;
42           my $oBook = $oEx->Create();
43           my $iF1 = $oBook->AddFont(
44                   Name      => 'Arial',
45                   Height    => 11,
46                   Bold      => 1, #Bold
47                   Italic    => 1, #Italic
48                   Underline => 0,
49                   Strikeout => 0,
50                   Super     => 0,
51               );
52           my $iFmt =
53           $oBook->AddFormat(
54               Font => $oBook->{Font}[$iF1],
55               Fill => [1, 10, 0],         # Filled with Red
56                                           # cf. ParseExcel (@aColor)
57               BdrStyle => [0, 1, 1, 0],   #Border Right, Top
58               BdrColor => [0, 11, 0, 0],  # Right->Green
59           );
60           $oBook->AddWorksheet('NewWS');
61           $oBook->AddCell(0, 0, 1, 'Cell', $iFmt);
62           $oEx->SaveAs($oBook, 'new.xls');
63
64       new interface...
65
66           use strict;
67           use Spreadsheet::ParseExcel::SaveParser;
68           $oBook =
69               Spreadsheet::ParseExcel::SaveParser::Workbook->Parse('Excel/Test97.xls');
70           my $oWs = $oBook->AddWorksheet('TEST1');
71           $oWs->AddCell(10, 1, 'New Cell');
72           $oBook->SaveAs('iftest.xls');
73

DESCRIPTION

75       Spreadsheet::ParseExcel::SaveParser : Expand of Spreadsheet::ParseExcel
76       with Spreadsheet::WriteExcel
77
78       Functions
79
80       new $oExcel = new Spreadsheet::ParseExcel::SaveParser();
81
82           Constructor.
83
84       Parse
85           $oWorkbook = $oParse->Parse($sFileName [, $oFmt]);
86
87           return "Workbook" object.  if error occurs, returns undef.
88
89           $sFileName
90               name of the file to parse (Same as Spreadsheet::ParseExcel)
91
92               From 0.12 (with OLE::Storage_Lite v.0.06), scalar reference of
93               file contents (ex. \$sBuff) or IO::Handle object (inclucdng
94               IO::File etc.) are also available.
95
96           $oFmt
97               Formatter Class to format the value of cells.
98
99       Create
100           $oWorkbook = $oParse->Create([$oFmt]);
101
102           return new "Workbook" object.  if error occurs, returns undef.
103
104           $oFmt
105               Formatter Class to format the value of cells.
106
107       SaveAs
108           $oWorkbook = $oParse->SaveAs( $oBook, $sName);
109
110           save $oBook image as an Excel file named $sName.
111
112           $oBook
113               An Excel Workbook object to save.
114
115       $sName
116           Name of new Excel file.
117
118       Workbook
119
120       Spreadsheet::ParseExcel::SaveParser::Workbook
121
122       Workbook is a subclass of Spreadsheet::ParseExcel::Workbook.  And has
123       these methods :
124
125       AddWorksheet
126           $oWorksheet = $oBook->AddWorksheet($sName, %hProperty);
127
128           Create new Worksheet(Spreadsheet::ParseExcel::Worksheet).
129
130           $sName
131               Name of new Worksheet
132
133           $hProperty
134               Property of new Worksheet.
135
136       AddFont
137           $oWorksheet = $oBook->AddFont(%hProperty);
138
139           Create new Font(Spreadsheet::ParseExcel::Font).
140
141           $hProperty
142               Property of new Worksheet.
143
144       AddFormat
145           $oWorksheet = $oBook->AddFormat(%hProperty);
146
147           Create new Format(Spreadsheet::ParseExcel::Format).
148
149           $hProperty
150               Property of new Format.
151
152       AddCell
153           $oWorksheet = $oBook->AddCell($iWorksheet, $iRow, $iCol, $sVal,
154           $iFormat [, $sCode]);
155
156           Create new Cell(Spreadsheet::ParseExcel::Cell).
157
158           $iWorksheet
159               Number of Worksheet
160
161           $iRow
162               Number of row
163
164           $sVal
165               Value of the cell.
166
167           $iFormat
168               Number of format for use. To specify just same as another cell,
169               you can set it like below:
170
171               ex.
172
173                 $oCell=$oWorksheet->{Cells}[0][0]; #Just a sample
174                 $oBook->AddCell(0, 1, 0, 'New One', $oCell->{FormatNo});
175                   #or
176                 $oBook->AddCell(0, 1, 0, 'New One', $oCell);
177
178           $sCode
179                 Character code
180
181       Worksheet
182
183       Spreadsheet::ParseExcel::SaveParser::Worksheet
184
185       Worksheet is a subclass of Spreadsheet::ParseExcel::Worksheet.  And has
186       these methods :
187
188       AddCell
189           $oWorksheet = $oWkSheet->AddCell($iRow, $iCol, $sVal, $iFormat [,
190           $sCode]);
191
192           Create new Cell(Spreadsheet::ParseExcel::Cell).
193
194           $iRow
195               Number of row
196
197           $sVal
198               Value of the cell.
199
200           $iFormat
201               Number of format for use. To specify just same as another cell,
202               you can set it like below:
203
204               ex.
205
206                 $oCell=$oWorksheet->{Cells}[0][0]; #Just a sample
207                 $oWorksheet->AddCell(1, 0, 'New One', $oCell->{FormatNo});
208                   #or
209                 $oWorksheet->AddCell(1, 0, 'New One', $oCell);
210
211           $sCode
212                 Character code
213

MORE INFORMATION

215       Please visit my Wiki page.
216        I'll add sample at :
217           http://www.hippo2000.info/cgi-bin/KbWikiE/KbWiki.pl
218

Known Problem

220       -Only last print area will remain. (Others will be removed)
221

AUTHOR

223       Kawai Takanori (Hippo2000) kwitknr@cpan.org
224
225           http://member.nifty.ne.jp/hippo2000/            (Japanese)
226           http://member.nifty.ne.jp/hippo2000/index_e.htm (English)
227

SEE ALSO

229       XLHTML, OLE::Storage, Spreadsheet::WriteExcel, OLE::Storage_Lite
230
231       This module is based on herbert within OLE::Storage and XLHTML.
232
234       Copyright (c) 2000-2002 Kawai Takanori and Nippon-RAD Co. OP Division
235       All rights reserved.
236
237       You may distribute under the terms of either the GNU General Public
238       License or the Artistic License, as specified in the Perl README file.
239

ACKNOWLEDGEMENTS

241       First of all, I would like to acknowledge valuable program and modules
242       : XHTML, OLE::Storage and Spreadsheet::WriteExcel.
243
244       In no particular order: Yamaji Haruna, Simamoto Takesi, Noguchi Harumi,
245       Ikezawa Kazuhiro, Suwazono Shugo, Hirofumi Morisada, Michael Edwards,
246       Kim Namusk and many many people + Kawai Mikako.
247
248
249
250perl v5.8.8                       2007-04S-p0r9eadsheet::ParseExcel::SaveParser(3)
Impressum