OSDN Git Service

#34479 対応中
[jaxcel/jaxcel.git] / Jaxcel / src / org / hanei / jaxcel / report / ReportMaker.java
1 /**\r
2  * Copyright 2014 Hanei Management Co.,Ltd. \r
3  * \r
4  * This file is part of Jaxcel\r
5  * \r
6  *  Jaxcel is free software: you can redistribute it and/or modify\r
7  *  it under the terms of the GNU Lesser General Public License as published by\r
8  *  the Free Software Foundation, either version 3 of the License, or\r
9  *  (at your option) any later version.\r
10  *\r
11  *  Jaxcel is distributed in the hope that it will be useful,\r
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  *  GNU Lesser General Public License for more details.\r
15  *\r
16  *  You should have received a copy of the GNU Lesser General Public License\r
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
18  */\r
19 package org.hanei.jaxcel.report;\r
20 \r
21 import java.io.BufferedInputStream;\r
22 import java.io.File;\r
23 import java.io.FileInputStream;\r
24 import java.io.FileOutputStream;\r
25 import java.io.IOException;\r
26 import java.io.InputStream;\r
27 import java.io.OutputStream;\r
28 import java.util.Map;\r
29 \r
30 \r
31 import org.apache.commons.collections.ExtendedProperties;\r
32 import org.apache.poi.hssf.usermodel.HSSFSheet;\r
33 import org.apache.poi.hssf.usermodel.HSSFWorkbook;\r
34 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
35 import org.apache.poi.openxml4j.opc.OPCPackage;\r
36 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;\r
37 import org.apache.poi.poifs.filesystem.OfficeXmlFileException;\r
38 import org.apache.poi.ss.usermodel.Cell;\r
39 import org.apache.poi.ss.usermodel.Row;\r
40 import org.apache.poi.ss.usermodel.Sheet;\r
41 import org.apache.poi.ss.usermodel.Workbook;\r
42 import org.apache.poi.ss.usermodel.WorkbookFactory;\r
43 import org.apache.poi.ss.util.CellReference;\r
44 import org.apache.poi.xssf.usermodel.XSSFChartSheet;\r
45 import org.apache.poi.xssf.usermodel.XSSFDialogsheet;\r
46 import org.apache.poi.xssf.usermodel.XSSFWorkbook;\r
47 import org.hanei.jaxcel.exception.JaxcelInputException;\r
48 import org.hanei.jaxcel.exception.JaxcelOutputException;\r
49 import org.hanei.jaxcel.parser.CellParser;\r
50 import org.slf4j.LoggerFactory;\r
51 import org.slf4j.Logger;\r
52 \r
53 /**\r
54  * Excel帳票生成クラス<br>\r
55  * テンプレートのExcelファイルにデータを挿入することでExcel帳票を生成する。\r
56  * \r
57  * <p>テンプレートの書式については、AbstractTLParserのサブクラスのJavadocを参照</p>\r
58  * \r
59  * @since 1.00.00\r
60  * @author Noboru Saito\r
61  */\r
62 public class ReportMaker {\r
63 \r
64         private static final Logger log = LoggerFactory.getLogger(ReportMaker.class);\r
65 \r
66         /**\r
67          * POIファイルシステム<br>\r
68          * Excel 2003 形式(.xls)\r
69          */\r
70         private NPOIFSFileSystem npoifs = null;\r
71         \r
72         /**\r
73          * POIファイルシステム<br>\r
74          * Excel 2007 形式(.xlsx, .xlsm)\r
75          */\r
76         private OPCPackage pkg = null;\r
77         \r
78         /**\r
79          *  EL式マネージャ\r
80          */\r
81         private ELManager elMgr = null;\r
82         \r
83         /**\r
84          *  コンテキスト\r
85          */\r
86         private JaxcelContext context  = null;\r
87         \r
88         /**\r
89          *  セルパーサ\r
90          */\r
91         private CellParser cellParser = null;\r
92 \r
93         /**\r
94          *  テンプレート一時ファイル\r
95          */\r
96         private File tempFile = null;\r
97 \r
98         /**\r
99          *  カスタムパーサ用ファイル\r
100          */\r
101         private ExtendedProperties customProperties = null;\r
102         \r
103         /**\r
104          * デフォルトコンストラクタ\r
105          */\r
106         public ReportMaker() {}\r
107 \r
108         /**\r
109          * カスタムパーサ用のプロパティファイルを指定\r
110          * \r
111          * @param properties カスタムパーサ用プロパティファイル\r
112          */\r
113         public ReportMaker(File properties) {\r
114                 setCustomProperties(properties);\r
115         }\r
116 \r
117         /**\r
118          * カスタムパーサ用のプロパティファイルを指定\r
119          * \r
120          * @param properties カスタムパーサ用プロパティファイル\r
121          */\r
122         public ReportMaker(InputStream properties) {\r
123                 setCustomProperties(properties);\r
124         }\r
125 \r
126         /**\r
127          * カスタムパーサ用のプロパティファイルセッター\r
128          * \r
129          * @param properties カスタムパーサ用プロパティファイル\r
130          */\r
131         public void setCustomProperties(File properties) {\r
132                 if(properties != null) {\r
133                         try(InputStream stream = new FileInputStream(properties)) {\r
134                                 setCustomProperties(stream);\r
135                         }\r
136                         catch(Exception e) {}\r
137                 }\r
138         }\r
139 \r
140         /**\r
141          * カスタムパーサ用のプロパティファイルセッター\r
142          * \r
143          * @param properties カスタムパーサ用プロパティファイル\r
144          */\r
145         public void setCustomProperties(InputStream properties) {\r
146                 try {\r
147                         if(properties != null) {\r
148                                 customProperties = new ExtendedProperties();\r
149                                 customProperties.load(properties);\r
150                         }\r
151                 }\r
152                 catch(Exception e) {}\r
153         }\r
154         \r
155         /**\r
156          * 入力ストリームのExcelテンプレートファイルにデータを挿入することでExcel帳票を生成、Workbookオブジェクトを返却する。<br>\r
157          * 返却されたWorkbookオブジェクトはPOIを使用し、加工・出力が可能。<br>\r
158          * 入力ストリームは別途クローズが必要。<br>\r
159          * Workbookオブジェクトの使用終了後はclose()メソッドでExcelテンプレートファイルのクローズが必要。\r
160          * \r
161          * @param template Excelテンプレートファイル入力ストリーム\r
162          * @param parameter テンプレートに挿入するデータ\r
163          * \r
164          * @return Workbookオブジェクト\r
165          * \r
166          * @throws JaxcelInputException 入力例外発生時\r
167          */\r
168         public Workbook makeReport(InputStream template, Map<String, Object> parameter) {\r
169                 log.trace("makeReport start");\r
170 \r
171                 // 引数チェック\r
172                 if(template == null) {\r
173                         log.error("template is null");\r
174                         throw new JaxcelInputException("template is null");\r
175                 }\r
176                 \r
177                 // 一時ファイル作成\r
178                 if (tempFile != null && tempFile.exists()) {\r
179                         tempFile.delete();\r
180                         log.debug("template file delete: {}", tempFile.getPath());\r
181                         tempFile = null;\r
182                 }\r
183                 tempFile = createTempFile(template);\r
184                 \r
185                 // Excel帳票生成\r
186                 Workbook book = makeReport(tempFile, parameter);\r
187                 \r
188                 log.trace("makeReport end");\r
189                 return book;\r
190         }\r
191 \r
192         /**\r
193          * 入力ストリームのExcelテンプレートファイルにデータを挿入することでExcel帳票を生成、出力ストリームにExcel帳票を出力する。<br>\r
194          * 入出力ストリームは別途クローズが必要。\r
195          * \r
196          * @param template Excelテンプレートファイル入力ストリーム\r
197          * @param parameter テンプレートに挿入するデータ\r
198          * @param output Excel帳票出力ストリーム\r
199          *\r
200          * @throws JaxcelInputException 入力例外発生時\r
201          * @throws JaxcelOutputException 出力例外発生時\r
202          */\r
203         public void makeReport(InputStream template, Map<String, Object> parameter, OutputStream output) {\r
204                 log.trace("makeReport start");\r
205                 \r
206                 // Excel帳票生成\r
207                 Workbook book = makeReport(template, parameter);\r
208                 \r
209                 // 出力\r
210                 outputReport(book, output);\r
211 \r
212                 // テンプレートファイルクローズ\r
213                 close();\r
214 \r
215                 log.trace("makeReport end");\r
216         }\r
217 \r
218          /**\r
219          * 入力ストリームのExcelテンプレートファイルにデータを挿入することでExcel帳票を生成、Excel帳票ファイルを出力する。<br>\r
220          * 入力ストリームは別途クローズが必要。\r
221          * \r
222          * @param template Excelテンプレートファイル入力ストリーム\r
223          * @param parameter テンプレートに挿入するデータ\r
224          * @param output Excel帳票出力ファイル\r
225          *\r
226          * @throws JaxcelInputException 入力例外発生時\r
227          * @throws JaxcelOutputException 出力例外発生時\r
228          */\r
229         public void makeReport(InputStream template, Map<String, Object> parameter, File output) {\r
230                 log.trace("makeReport start");\r
231                 \r
232                 // Excel帳票生成\r
233                 Workbook book = makeReport(template, parameter);\r
234                 \r
235                 // 出力ストリーム\r
236                 FileOutputStream _output;\r
237                 try {\r
238                         _output = new FileOutputStream(output);\r
239                 }\r
240                 catch(Exception e) {\r
241                         log.error("output file open error: {}", e.getMessage(), e);\r
242                         throw new JaxcelOutputException("output file open error");\r
243                 }\r
244 \r
245                 // 出力\r
246                 outputReport(book, _output);\r
247                 try {\r
248                         _output.close();\r
249                 } catch (IOException e) {\r
250                         log.error("output file close error: {}", e.getMessage(), e);\r
251                         throw new JaxcelOutputException("output file close error");\r
252                 }\r
253 \r
254                 // テンプレートファイルクローズ\r
255                 close();\r
256 \r
257                 log.trace("makeReport end");\r
258         }\r
259         \r
260         /**\r
261          * Excelテンプレートファイルにデータを挿入することでExcel帳票を生成、Workbookオブジェクトを返却する。<br>\r
262          * 返却されたWorkbookオブジェクトはPOIを使用し、加工・出力が可能。<br>\r
263          * Workbookオブジェクトの使用終了後はclose()メソッドでExcelテンプレートファイルのクローズが必要。\r
264          * \r
265          * @param template Excelテンプレートファイル\r
266          * @param parameter テンプレートに挿入するデータ\r
267          * \r
268          * @return Workbookオブジェクト\r
269          * \r
270          * @throws JaxcelInputException 入力例外発生時\r
271          */\r
272         public Workbook makeReport(File template, Map<String, Object> parameter) {\r
273                 log.trace("makeReport start");\r
274 \r
275                 // 引数チェック\r
276                 if(template == null) {\r
277                         log.error("template file is null");\r
278                         throw new JaxcelInputException("template file is null");\r
279                 }\r
280                 else if(!template.exists()) {\r
281                         log.error("template file does not exist: {}", template.getAbsolutePath());\r
282                         throw new JaxcelInputException("template file does not exist");\r
283                 }\r
284                 else if(!template.canRead()) {\r
285                         log.error("template file can not read: {}", template.getAbsolutePath());\r
286                         throw new JaxcelInputException("template file can not read");\r
287                 }\r
288                 if(parameter == null) {\r
289                         log.debug("parameter is null");\r
290                 }\r
291 \r
292                 // Excelテンプレートファイルオープン\r
293                 Workbook book = openWorkbook(template);\r
294                 \r
295                 // Excel帳票生成\r
296                 makeReport(book, parameter);\r
297                 \r
298                 log.trace("makeReport end");\r
299                 return book;\r
300         }\r
301 \r
302         /**\r
303          * Excelテンプレートファイルにデータを挿入することでExcel帳票を生成、出力ストリームにExcel帳票を出力する。<br>\r
304          * 出力ストリームは別途クローズが必要。\r
305          * \r
306          * @param template Excelテンプレートファイル\r
307          * @param parameter テンプレートに挿入するデータ\r
308          * @param output Excel帳票出力ストリーム\r
309          * \r
310          * @throws JaxcelInputException 入力例外発生時\r
311          * @throws JaxcelOutputException 出力例外発生時\r
312          */\r
313         public void makeReport(File template, Map<String, Object> parameter, OutputStream output) {\r
314                 log.trace("makeReport start");\r
315 \r
316                 // Workbook生成\r
317                 Workbook book = makeReport(template, parameter);\r
318 \r
319                 // 出力\r
320                 outputReport(book, output);\r
321         \r
322                 // テンプレートファイルクローズ\r
323                 close();\r
324 \r
325                 log.trace("makeReport end");\r
326         }\r
327 \r
328         /**\r
329          * Excelテンプレートファイルにデータを挿入することでExcel帳票を生成、Excel帳票ファイルを出力する。<br>\r
330          * \r
331          * @param template Excelテンプレートファイル\r
332          * @param parameter テンプレートに挿入するデータ\r
333          * @param output Excel帳票出力ファイル\r
334          * \r
335          * @throws JaxcelInputException 入力例外発生時\r
336          * @throws JaxcelOutputException 出力例外発生時\r
337          */\r
338         public void makeReport(File template, Map<String, Object> parameter, File output) {\r
339                 log.trace("makeReport start");\r
340 \r
341                 // Workbook生成\r
342                 Workbook book = makeReport(template, parameter);\r
343 \r
344                 // 出力ストリーム\r
345                 FileOutputStream _output;\r
346                 try {\r
347                         _output = new FileOutputStream(output);\r
348                 }\r
349                 catch(Exception e) {\r
350                         log.error("output file open error: {}", e.getMessage(), e);\r
351                         throw new JaxcelOutputException("output file open error");\r
352                 }\r
353 \r
354                 // 出力\r
355                 outputReport(book, _output);\r
356                 try {\r
357                         _output.close();\r
358                 } catch (IOException e) {\r
359                         log.error("output file close error: {}", e.getMessage(), e);\r
360                         throw new JaxcelOutputException("output file close error");\r
361                 }\r
362                 \r
363                 // テンプレートファイルクローズ\r
364                 close();\r
365 \r
366                 log.trace("makeReport end");\r
367         }\r
368         \r
369         /**\r
370          * ExcelテンプレートのWorkbookオブジェクトにデータを挿入することでExcel帳票を生成する。<br>\r
371          * Workbookオブジェクトの使用終了後はclose()メソッドでExcelテンプレートファイルのクローズが必要。\r
372          * \r
373          * @param book Workbookオブジェクト\r
374          * @param parameter テンプレートに挿入するデータ\r
375          * \r
376          * @throws JaxcelInputException 入力例外発生時\r
377          */\r
378         public void makeReport(Workbook book, Map<String, Object> parameter) {\r
379                 log.trace("makeReport start");\r
380 \r
381                 // 引数チェック\r
382                 if(book == null) {\r
383                         log.error("workbook is null");\r
384                         throw new JaxcelInputException("Workbook is null");\r
385                 }\r
386                 else if(!(book instanceof HSSFWorkbook) && !(book instanceof XSSFWorkbook)) {\r
387                         log.error("Workbook is unsupport type: {}", book.getClass().getName());\r
388                         throw new JaxcelInputException("Workbook is unsupported type");\r
389                 }\r
390                 if(parameter == null) {\r
391                         log.debug("parameter is null");\r
392                 }\r
393 \r
394                 // コンテキスト生成\r
395                 context = new JaxcelContext();\r
396 \r
397                 // EL式マネージャ生成。パラメータ設定\r
398                 elMgr = new ELManager();\r
399                 elMgr.setParameter(parameter);\r
400                 \r
401                 // コンテキストにEL式マネージャ設定\r
402                 context.setElManager(elMgr);\r
403                 \r
404                 // コンテキストにカスタムプロパティ設定\r
405                 context.setCustomProperties(customProperties);\r
406 \r
407                 // Book生成\r
408                 makeBook(book);\r
409                 \r
410                 log.trace("makeReport end");\r
411         }\r
412 \r
413         /**\r
414          * ワークブックのオープン\r
415          * \r
416          * @param template Excelテンプレートファイル\r
417          * \r
418          * @throws JaxcelInputException Excelテンプレートファイルオープン失敗時\r
419          */\r
420         private Workbook openWorkbook(File template) {\r
421                 log.trace("openWorkbook start");\r
422 \r
423                 // Workbookオブジェクト \r
424                 Workbook book = null;\r
425 \r
426                 // Excel2003以前\r
427                 try {\r
428                         npoifs = new NPOIFSFileSystem(template);\r
429                         book = WorkbookFactory.create(npoifs);\r
430                 } catch (OfficeXmlFileException | IOException e1) {\r
431                         // Excel2007以降\r
432                         try {\r
433                                 pkg = OPCPackage.open(template);\r
434                                 book = WorkbookFactory.create(pkg);\r
435                         } catch (InvalidFormatException | IOException e2) {\r
436                                 log.error("template file open error: [{}]. [{}]", e1.getMessage(), e2.getMessage());\r
437                         }\r
438                 }\r
439 \r
440                 // チェック\r
441                 if(book == null) {\r
442                         throw new JaxcelInputException("template file open error");\r
443                 }\r
444         \r
445                 log.trace("openWorkbook end");\r
446                 return book;\r
447         }\r
448 \r
449         \r
450         /**\r
451          * 出力ストリームにワークブックを出力する\r
452          * \r
453          * @version 1.00.00\r
454          * @param book  Workbookオブジェクト\r
455          * @param output        出力ストリーム\r
456          *\r
457          * @throws JaxcelOutputException 出力例外発生時\r
458          */\r
459         private void outputReport(Workbook book, OutputStream output) {\r
460                 log.trace("outputReport start");\r
461 \r
462                 try {\r
463                         book.write(output);\r
464                 } catch (Exception e) {\r
465                         log.error("workbook output error: {}", e.getMessage(), e);\r
466                         throw new JaxcelOutputException("workbook output error");\r
467                 }\r
468                 \r
469                 log.trace("outputReport end");\r
470         }\r
471 \r
472         /**\r
473          * Excelテンプレートファイルのクローズ<br>\r
474          * テンプレートファイルの変更は保存しません。\r
475          * \r
476          * @throws JaxcelOutputException 出力例外発生時\r
477          */\r
478         public void close() {\r
479                 log.trace("close start");\r
480 \r
481                 try {\r
482                         if (npoifs != null) {\r
483                                 npoifs.close();\r
484                                 log.debug("template file close.");\r
485                                 npoifs = null;\r
486                         }\r
487                         if (pkg != null) {\r
488                                 pkg.revert();\r
489                                 log.debug("template file close.");\r
490                                 pkg = null;\r
491                         }\r
492                         if (tempFile != null && tempFile.exists()) {\r
493                                 tempFile.delete();\r
494                                 log.debug("template file delete: {}", tempFile.getPath());\r
495                                 tempFile = null;\r
496                         }\r
497                 } catch (IOException e) {\r
498                         log.error("template file close error: {}", e.getMessage(), e);\r
499                         throw new JaxcelOutputException("template file close error");\r
500                 }\r
501 \r
502                 log.trace("close end");\r
503         }\r
504 \r
505         /**\r
506          * InputStreamから一時ファイルを作成\r
507          * @param template\r
508          * @return Fileオブジェクト\r
509          * \r
510          * @throws JaxcelInputException 一時ファイル作成エラー発生時\r
511          */\r
512         private File createTempFile(InputStream template) {\r
513                 log.trace("createTempFile start");\r
514                 \r
515                 final String PREFIX = "org.hanei.jaxcel_";\r
516                 final String SUFFIX = ".tmp";\r
517                 final int BUF_SIZE = 1024;\r
518                 \r
519                 BufferedInputStream inStream = null;\r
520                 File tmpFile = null;\r
521                 \r
522                 if(template instanceof BufferedInputStream) {\r
523                         inStream = (BufferedInputStream) template;\r
524                 }\r
525                 else {\r
526                         inStream = new BufferedInputStream((InputStream) template);\r
527                 }\r
528                 try {\r
529                         tmpFile = File.createTempFile(PREFIX, SUFFIX);\r
530                         FileOutputStream outStream = new FileOutputStream(tmpFile);\r
531                         \r
532                         byte buf[]=new byte[BUF_SIZE];\r
533                         int len;\r
534                         while((len = inStream.read(buf)) != -1){\r
535                                  outStream.write(buf, 0, len);\r
536                         }\r
537                         outStream.flush();\r
538                         outStream.close();\r
539                         log.debug("createTempFile: {}", tmpFile.getPath());\r
540                 } catch (SecurityException | IOException e) {\r
541                         log.error("template file create error: {}", e.getMessage());\r
542                         throw new JaxcelInputException("template file create error");\r
543                 }\r
544                 \r
545                 log.trace("createTempFile end");\r
546                 return tmpFile;\r
547         }\r
548 \r
549         /**\r
550          * Workbook生成\r
551          * @param book Workbookオブジェクト\r
552          */\r
553         private void makeBook(Workbook book) {\r
554                 log.trace("makeBook start");\r
555                 \r
556                 // セルパーサ生成\r
557                 cellParser = new CellParser(context);\r
558                 \r
559                 // シートでループ\r
560                 log.debug("sheet count: {}", book.getNumberOfSheets());\r
561                 for(int i = 0; i < book.getNumberOfSheets(); i++) {\r
562                         // カレントシート取得\r
563                         Sheet sheet = book.getSheetAt(i);\r
564                         if(sheet == null) {\r
565                                 log.warn("sheet[{}] is null. skip", i);\r
566                                 continue;\r
567                         }\r
568                         else if((sheet instanceof HSSFSheet && ((HSSFSheet)sheet).getDialog()) || (sheet instanceof XSSFDialogsheet)) {\r
569                                 log.debug("sheet[{}] is dialog sheet. skip", i);\r
570                                 continue;\r
571                         }\r
572                         else if(sheet instanceof XSSFChartSheet) {\r
573                                 log.debug("sheet[{}] is chart sheet. skip", i);\r
574                                 continue;\r
575                         }\r
576                         \r
577                         log.debug("sheet[{}] name: {}", i, sheet.getSheetName());\r
578 \r
579                         // シート生成\r
580                         makeSheet(sheet);\r
581                 }\r
582                 \r
583                 // 再計算\r
584                 book.setForceFormulaRecalculation(true);\r
585                 \r
586                 log.trace("makeBook end");\r
587         }\r
588         \r
589         /**\r
590          * ワークシート生成\r
591          * @param sheet ワークシートオブジェクト\r
592      */\r
593         private void makeSheet(Sheet sheet) {\r
594                 log.trace("makeSheet start");\r
595                 \r
596                 Row row;                                                // 行オブジェクト\r
597                 Cell cell;                                              // セルブジェクト\r
598 \r
599                 // カレントシート設定、パーサ生成\r
600                 context.setCurrentSheet(sheet);\r
601 \r
602                 //最大行数\r
603                 int lastRowNum = sheet.getLastRowNum();\r
604                 log.debug("lastRowNum: {}", lastRowNum);\r
605                 \r
606                 //最大セル数\r
607                 int maxColNum = 0;\r
608                 \r
609                 // 行方向にループ\r
610                 for(int rowIdx = 0; rowIdx <= lastRowNum; rowIdx++) {\r
611                         // 行取得\r
612                         row = sheet.getRow(rowIdx);\r
613 \r
614                         // チェック\r
615                         if(row == null) {\r
616                                 log.debug("row[{}] is null", (rowIdx + 1));\r
617                                 continue;\r
618                         }\r
619 \r
620                         // 列最終取得・最大列数更新\r
621                         maxColNum = row.getLastCellNum();\r
622                         log.debug("maxColNum: {}", maxColNum);\r
623 \r
624                         // 列方向にループ\r
625                         for(int cellIdx = 0; cellIdx < maxColNum; cellIdx++) {\r
626                                 // セル取得\r
627                                 cell = row.getCell(cellIdx);\r
628 \r
629                                 // チェック\r
630                                 if(cell == null) {\r
631                                         log.debug("cell[{}] is null", (new CellReference(rowIdx, cellIdx)).formatAsString());\r
632                                         continue;\r
633                                 }\r
634                                 \r
635                                 // セルタイプにより分岐\r
636                                 switch (cell.getCellType()) {\r
637                                 // 文字列セル、計算式セル\r
638                                 case Cell.CELL_TYPE_STRING:\r
639                                 case Cell.CELL_TYPE_FORMULA:\r
640                                         if(log.isDebugEnabled()) {\r
641                                                 log.debug("cell[{}] type is {}", (new CellReference(cell)).formatAsString(), (cell.getCellType() == Cell.CELL_TYPE_STRING ? "string" : "formula"));\r
642                                         }\r
643                                         // パース\r
644                                         cellParser.parse(cell);\r
645                                         // 再パースフラグONなら\r
646                                         if(cellParser.isReParseCell()) {\r
647                                                 // もう一度そのセルからループする\r
648                                                 cellIdx--;\r
649                                         }\r
650                                         break;\r
651                                 // 文字列セル、計算式セル以外\r
652                                 default:\r
653                                         log.debug("cell[{}] type is not string or formula", (new CellReference(cell)).formatAsString());\r
654                                         continue;\r
655                                 }\r
656                         }\r
657                         //最大行数更新\r
658                         if(lastRowNum < sheet.getLastRowNum()) {\r
659                                 lastRowNum = sheet.getLastRowNum();\r
660                                 log.debug("lastRowNum update: {}", lastRowNum);\r
661                         }\r
662                 }\r
663                 log.trace("transformSheet end");\r
664         }\r
665 }\r