001    /*
002     * Copyright (c) 2009 The openGion Project.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013     * either express or implied. See the License for the specific language
014     * governing permissions and limitations under the License.
015     */
016    package org.opengion.hayabusa.taglib;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.common.HybsSystemException;
020    import org.opengion.hayabusa.db.DBTableModel;
021    import org.opengion.hayabusa.io.TableWriter;
022    import org.opengion.fukurou.util.FileUtil;
023    import org.opengion.fukurou.util.HybsEntry;
024    import org.opengion.fukurou.util.Closer ;
025    import org.opengion.fukurou.util.StringUtil ;
026    import static org.opengion.fukurou.util.StringUtil.nval ;
027    
028    import javax.servlet.ServletResponse ;
029    import javax.servlet.http.HttpServletResponse ;
030    import javax.servlet.jsp.JspWriter ;
031    
032    import java.util.zip.GZIPOutputStream;
033    import java.util.zip.ZipOutputStream;
034    import java.util.zip.ZipEntry;
035    import java.util.List;
036    import java.util.ArrayList;
037    import java.util.Locale;
038    import java.io.File;
039    import java.io.OutputStream;
040    import java.io.PrintWriter;
041    import java.io.FileOutputStream;
042    import java.io.ByteArrayOutputStream;
043    import java.io.ObjectOutputStream;
044    import java.io.ObjectInputStream;
045    import java.io.IOException;
046    
047    /**
048     * DBTableModelオブジェクトをæŒ?®šã?ファイルに出力するタグですã?
049     *
050     * ãƒ??タ(DBTableModel)と、コントローラ(WriteTableTagForm)を与えてã€?
051     * 外部からコントロールすることで、各種形式で ãƒ??タ(DBTableModel)を表示できますã?
052     * writeTableタグ に対して、コマンドを与えることにより、å?部のコントローラの
053     * 実è£?�«対応したã? 形式でãƒ??タを作æ?しますã?
054     *
055     * @og.formSample
056     * ●形式ï¼?
057     *     <og:writeTable
058     *         fileURL   = "{@USER.ID}"    保存å?ãƒ?‚£レクトリå�?
059     *         filename  = "{@filename}"   保存ファイルå�?
060     *         encode    = "UnicodeLittle"      保存ファイルエンコード名
061     *     />
062     *
063     * ●body?šあã‚?EVAL_BODY_BUFFERED:BODYを評価しã?{@XXXX} を解析しまã�?
064     *
065     * ●Tag定義??
066     *   <og:writeTable
067     *       writerClass        【TAG】実際に書きå?すクラス名ã?略称(TableWriter_**** クラスの ****)を指定しまã�?初期値:Default)
068     *       separator          【TAG】可変長ファイルを作æ?するときã?é ?›®区åˆ?‚Šæ–?­—をセãƒ?ƒˆしまã�?(初期値:TableWriter#TAB_SEPARATOR[= ])
069     *       headerSequence     【TAG】DBTableModelの出力é?(LNSCD など)をセãƒ?ƒˆしまã�?
070     *       fileURL            【TAG】ファイル保存å?ãƒ?‚£レクトリ名をæŒ?®šしまã�?
071     *       filename           【TAG】ファイルを作æ?するときã?ファイル名をセãƒ?ƒˆしまã�?(初期値:FILE_FILENAME[=UnicodeLittle])
072     *       beforeDelete       【TAG】事前にファイルを削除するかどã�?�‹をセãƒ?ƒˆしまã�?(初期値:false)
073     *       encode             【TAG】ファイルを作æ?するときã?ファイルエンコーãƒ?‚£ング名をセãƒ?ƒˆしまã�?(初期値:FILE_ENCODE[=UnicodeLittle])
074     *       fileAppend         【TAG】追åŠ?ƒ¢ードで書き込ã‚?�‹どã�?�‹[true/false]を指定しまã�?初期値:false[新規モード])
075     *       direct             【å»?­¢】結果をダイレクトにEXCEL起動するかどã�?�‹[true/false]を指定しまã�?初期値:false[ファイル])
076     *       zip                【TAG】結果をファイルに出力するときに、ZIPで圧縮するかどã�?�‹[true/false]を指定しまã�?初期値:false)
077     *       tableId            【TAGã€?通常使ã�?�¾せん)sessionからæ‰?¾—すã‚?DBTableModelオブジェクトã? ID
078     *       scope              【TAG】キャãƒ?‚·ュする場合ã?スコープ[request/page/session/applicaton]を指定しまã�?初期値:session)
079     *       disposition        【TAG】Content-Disposition (inline:埋め込ã‚?attachment:ãƒ?‚¤アログを起å‹?を指定しまã�?初期値:attachment)
080     *       sheetName          【TAG】EXCELファイルを書きå?すときã?シート名を設定しまã�?
081     *       refSheetName       【TAG】EXCEL雛型参è?ファイルのシート名を設定しまã�?
082     *       refFileURL         【TAG】EXCEL雛型参ç?ファイルのãƒ?‚£レクトリ名をセãƒ?ƒˆしまã�?
083     *       refFilename        【TAG】EXCEL雛型参è?ファイル名をセãƒ?ƒˆしまã�?
084     *       useNumber          【TAG】行番号æƒ??をã?出力すã‚?しない[true/false]を指定しまã�?初期値:true)
085     *       columns            【TAG】書き込み先ファイルのカラãƒ??をã?外部(タグ)よりæŒ?®šしまã�?
086     *       useRenderer        【TAG】書込処ç�?�§コードリソースのラベル変換を行うかどã�?�‹を指定しまã�?(初期値:USE_TABLE_WRITER_RENDERER[=false])
087     *       selectedAll        【TAG】チェãƒ?‚¯行ã?みを対象にするかをæŒ?®šしまã�?初期値:true)ã€?
088     *       fontName           【TAG】EXCEL出力時のãƒ?ƒ•ォルトフォント名を設定しまã�?(初期値:TABLE_WRITER_DEFAULT_FONT_NAME[=?­?³ ?°ゴシãƒ?‚¯])
089     *       fontPoint          【TAG】EXCEL出力時のãƒ?ƒ•ォルトフォントã?イント数を設定しまã�?
090     *       language           【TAG】タグå†?ƒ¨で使用するè¨?ªžコード[ja/en/zh/…]を指定しまã�?
091     *       debug              【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
092     *   >   ... Body ...
093     *   </og:writeTable>
094     *
095     * ●使用ä¾?
096     *     <og:writeTable ?¥?¥?¥?¥?¥ >
097     *         <og:writeTableParam
098     *             key  = "Tablename"  value="GE12"
099     *         />
100     *         <og:writeTableParam
101     *             key  = "First"             First:æœ??に登録
102     *         >
103     *                      insert into GE12bk
104     *                         select * from GE12
105     *                         where SYSTEM_ID='**'
106     *         </og:writeTableParam
107     *         <og:writeTableParam
108     *             key  = "First"             First:の?’番目に登録
109     *         >
110     *              delete from GE12 where SYSTEM_ID='**' and KBSAKU='0'
111     *         </og:writeTableParam
112     *         <og:writeTableParam
113     *             key  = "Last"              Last:æœ?¾Œに登録
114     *         >
115     *              update GE12 set XXXX='YYYY' where SYSTEM_ID='**' and KBSAKU='0'
116     *         </og:writeTableParam
117     *     </og:writeTableParam
118     *
119     * @og.group ファイル出åŠ?
120     *
121     * @version  4.0
122     * @author   Kazuhiko Hasegawa
123     * @since    JDK5.0,
124     */
125    public class WriteTableTag extends CommonTagSupport {
126            //* こã?プログラãƒ??VERSIONæ–?­—å?を設定しますã?       {@value} */
127            private static final String VERSION = "5.5.9.1 (2012/12/07)" ;
128    
129            private static final long serialVersionUID = 559120121207L ;
130    
131            private final String  BASE_URL  = HybsSystem.sys( "FILE_URL" );
132    
133            private String  separator               = TableWriter.TAB_SEPARATOR;     // é ?›®区åˆ?‚Šæ–?­?
134            private String  headerSequence  = null;                 // ヘッãƒ??é ?›®の並びé ?
135            private String  fileURL                 = BASE_URL;
136            private String  filename                = HybsSystem.sys( "FILE_FILENAME" );   // ファイルå�?
137            private String  refFileURL              = BASE_URL;             // 3.5.4.3 (2004/01/05)
138            private String  refFilename     = null;                 // 3.5.4.3 (2004/01/05)
139            private String  fontName                = HybsSystem.sys( "TABLE_WRITER_DEFAULT_FONT_NAME" );                   // 3.8.5.3 (2006/08/07)
140            private String  fontPoint               = HybsSystem.sys( "TABLE_WRITER_DEFAULT_FONT_POINTS" );                 // 3.8.5.3 (2006/08/07)
141            private String  encode                  = HybsSystem.sys( "FILE_ENCODE" );      // ファイルエンコーãƒ?‚£ング  "DEFAULT","JISAutoDetect" ,"JIS", "EUC_JP", "MS932", "SJIS" , "Windows-31J" , "Shift_JIS"
142            private String  writerClass     = HybsSystem.sys( "TABLE_WRITER_DEFAULT_CLASS" );               // 3.8.5.3 (2006/08/07)
143            private boolean fileAppend              = false;                // ファイルをAPPENDモードで出力するか
144            private boolean direct                  = false;
145            private boolean zip                     = false;
146            private String  disposition     = "attachment";   // 3.8.0.9 (2005/10/17) Content-Disposition 初期値変更 inline â‡?attachment
147    
148            private transient DBTableModel table      = null;
149            private String  tableId                 = HybsSystem.TBL_MDL_KEY ;
150            private String  sheetName               = "Sheet1" ;    // 3.5.4.2 (2003/12/15)
151            private String  refSheetName    = null ;                // 3.5.4.3 (2004/01/05)
152            private String  directory               = null ;                // 3.8.6.0 (2006/08/23)
153    
154            private transient List<HybsEntry> param   = null ;                // 4.0.0 (2005/02/28)
155    
156            private boolean useNumber               = true;                 // 3.7.0.2 (2005/02/14)
157            // 4.0.0 (2005/12/31) 外部よりカラãƒ??(カンマ区åˆ?‚Š)を指定できるようにするã€?
158            private String          columns         = null;
159            // 5.2.1.0 (2010/10/01) 書込処ç�?�§コードリソースのラベル変換を行うかどã�?�‹
160            private boolean useRenderer             = HybsSystem.sysBool( "USE_TABLE_WRITER_RENDERER" );    // 5.2.1.0 (2010/10/01)
161            
162            // 5.5.5.5 (2012/08/24) チェãƒ?‚¯対å¿?
163            private boolean selectedAll             = true;                 // 5.5.5.5 (2012/08/24)
164    
165            // 5.5.9.1 (2012/12/07) 事前にファイルを削除するかどã�?�‹。互換性のため、false に設定ã?推奨は、true
166            private boolean beforeDelete    = false;                // 5.5.9.1 (2012/12/07) 事前にファイルを削除するかどã�?�‹ã€?
167    
168            /**
169             * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
170             *
171             * @og.rev 5.5.9.1 (2012/12/07) 事前にファイルを削除するかどã�?�‹??eforeDelete?‰フラグを追åŠ?
172             *
173             * @return      後続å?ç�??æŒ?¤º( EVAL_BODY_BUFFERED )
174             */
175            @Override
176            public int doStartTag() {
177    
178                    directory = HybsSystem.url2dir( fileURL );              // 5.5.9.1 (2012/12/07) doEndTag() から移å‹?
179    
180                    // 5.5.9.1 (2012/12/07) 事前にファイルを削除するかどã�?�‹
181                    if( beforeDelete && !fileAppend ) {
182                            File delFile = null;
183                            if( zip ) { delFile = new File( directory,filename + ".zip" ); }
184                            else      { delFile = new File( directory,filename ); }
185                            if( delFile.exists() ) { delFile.delete(); }
186                    }
187    
188                    return( EVAL_BODY_BUFFERED );   // Body を評価するã€? extends BodyTagSupport æ™?
189            }
190    
191            /**
192             * Taglibの終äº?‚¿グが見つかったときに処ç�?�™ã‚?doEndTag() ã‚?オーバã?ライドしますã?
193             *
194             * @og.rev 2.1.3.1 (2002/12/13) ContentType をã?x-msexcel から vnd.ms-excel に変更したã€?
195             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
196             * @og.rev 3.1.3.0 (2003/04/10) FILE_ENCODE から、エンコード情報を取得するã?
197             * @og.rev 3.1.5.0 (2003/04/20) Content-Disposition を外部からæŒ?®šできるように変更ã€?
198             * @og.rev 3.2.0.0 (2003/05/22) GZIPOutputStream を使用してã�?�Ÿがã?ZipOutputStream に変更ã€?
199             * @og.rev 3.5.4.1 (2003/12/01) 引数の PrintWriter をã?OutputStream に変更ã€?
200             * @og.rev 3.5.4.3 (2004/01/05) 引数をã? PrintWriter に戻すã?
201             * @og.rev 3.6.0.2 (2004/10/04) EXCELãƒ?‚¤レクトå?力時にファイルエンドまで出力されなã�?¸�å?合対ç­?
202             * @og.rev 3.8.0.9 (2005/10/17) disposition属æ?を使用できるように変更しますã?
203             * @og.rev 3.8.6.0 (2006/08/23) フォルãƒ?�Œなã�??合ã?、è¤?•°階層åˆ??フォルãƒ?‚’自動で作æ?しますã?
204             * @og.rev 4.3.4.3 (2008/12/22) Excel出力ã?判別方法を前方ä¸??に変更
205             * @og.rev 5.1.6.0 (2010/05/01) 画面帳票作æ?機è?対å¿?
206             * @og.rev 5.5.2.0 (2012/05/01) ZIP時にもencodeが有効にする
207             * @og.rev 5.5.5.5 (2012/08/24) selectedAllの処ç�?‚’追åŠ?
208             * @og.rev 5.5.9.1 (2012/12/07) beforeDeleteフラグの追åŠ?�«伴ã�??ロジãƒ?‚¯変更
209             *
210             * @return      後続å?ç�??æŒ?¤º
211             */
212            @Override
213            public int doEndTag() {
214                    debugPrint();           // 4.0.0 (2005/02/28)
215    
216                    table = (DBTableModel)getObject( tableId );
217                    if( ! selectedAll ){ // 5.5.5.5 (2012/08/24) 
218                            table = getSelRowsTable( table );
219                    }
220                    if( table != null && table.getRowCount() > 0 ) {
221    
222    //                      directory = HybsSystem.url2dir( fileURL );              // 5.5.9.1 (2012/12/07) beforeDeleteフラグの追åŠ?�«伴ã�??doStartTag() に移å‹?
223                            File dir = new File(directory);
224                            if( ! dir.exists() && ! dir.mkdirs() ) {
225                                    String errMsg = "ãƒ?‚£レクトリの作æ?に失敗しましたã€?" + directory + "]";
226                                    throw new HybsSystemException( errMsg );
227                            }
228    
229                            PrintWriter pw = null;
230                            ByteArrayOutputStream bt = null ;
231                            try {
232                                    if( direct ) {
233                                            if( zip ) {
234                                                    bt = new ByteArrayOutputStream();
235                                                    pw = new PrintWriter( bt );
236                                                    create( pw ) ;
237                                                    pw.flush();                             // 3.6.0.2 (2004/10/04)
238                                                    ServletResponse response = pageContext.getResponse() ;
239                                                    ((HttpServletResponse)response).addHeader( "Content-Encoding","gzip" );
240    
241                                                    GZIPOutputStream gzip = new GZIPOutputStream(bt);
242                                                    gzip.finish() ;
243                                                    response.setContentLength( (bt).size() );
244    
245                                                    JspWriter out = pageContext.getOut();
246                                                    out.clear();
247                                                    out.print( bt );
248                                                    out.flush();                    // 3.6.0.2 (2004/10/04)
249                                            }
250                                            else {
251                                                    bt = new ByteArrayOutputStream();
252                                                    pw = new PrintWriter( bt );
253                                                    create( pw ) ;
254                                                    pw.flush();                             // 3.6.0.2 (2004/10/04)
255                                                    ServletResponse response = pageContext.getResponse() ;
256                                                    response.setContentType( "application/vnd.ms-excel; charset=" + encode );
257            //                                      response.setContentType( "application/x-msexcel; charset=" + encode );
258            //                                      response.setContentType( "text/comma-separated-values ; charset=" + encode );
259            //                                      ((HttpServletResponse)response).setHeader( "contentType","application/x-msexcel; charset=Shift_JIS" );
260            //                                      ((HttpServletResponse)response).setHeader( "Content-Disposition","attachment; filename=\"" + filename + "\"" );
261            //                                      ((HttpServletResponse)response).setHeader( "Content-Disposition","inline; filename=\"" + filename + "\"" );
262                                                    // 3.8.0.9 (2005/10/17) disposition属æ?を使用できるように変更しますã?
263                                                    ((HttpServletResponse)response).setHeader( "Content-Disposition",disposition + "; filename=\"" + filename + "\"" );
264    
265                                                    JspWriter out = pageContext.getOut();
266                                                    out.clear();
267                                                    out.print( bt );
268                                                    out.flush();                    // 3.6.0.2 (2004/10/04)
269                                            }
270                                    }
271                                    else {
272                                    // 3.2.0.0 (2003/05/22) GZIPOutputStream を使用してã�?�Ÿがã?ZipOutputStream に変更ã€?
273                                            if( zip ) {
274                                                    bt = new ByteArrayOutputStream();
275                                                    if( ( writerClass.toUpperCase(Locale.JAPAN) ).startsWith("EXCEL") // 5.5.2.0(2012/05/01)
276                                                                    ||  ( writerClass.toUpperCase(Locale.JAPAN) ).startsWith("CALC") ) {
277                                                            pw = new PrintWriter( bt );
278                                                    }
279                                                    else{
280                                                            pw = getPrintWriter(bt);
281                                                    }
282                                                    create( pw ) ;
283                                                    pw.flush();                             // 3.6.0.2 (2004/10/04)
284    
285                                                    ZipOutputStream gzip = null;
286                                                    try {
287                                                            gzip = new ZipOutputStream(
288                                                                                            new FileOutputStream(
289                                                                                                    StringUtil.urlAppend( directory,filename + ".zip" )));
290                                                            gzip.putNextEntry( new ZipEntry( filename ) );
291                                                            (bt).writeTo( gzip );
292                                                            gzip.finish() ;
293                                                    }
294                                                    finally {
295                                                            Closer.ioClose( gzip );         // 4.0.0 (2006/01/31) close 処ç�?™‚の IOException を無è¦?
296                                                    }
297                                            }
298                                            else {
299                                                    // if( "Excel".equalsIgnoreCase( writerClass ) ) {
300    //                                              if( ( writerClass.toUpperCase(Locale.JAPAN) ).startsWith("EXCEL") ){ // 4.3.4.3 (2008/12/22)
301                                                    if( ( writerClass.toUpperCase(Locale.JAPAN) ).startsWith("EXCEL") // 4.3.4.3 (2008/12/22)
302                                                    ||  ( writerClass.toUpperCase(Locale.JAPAN) ).startsWith("CALC") ) { // 5.1.6.0 (2010/05/01)
303                                                            create( null );
304                                                    }
305                                                    else {
306                                                            pw = getPrintWriter();
307                                                            create( pw );
308                                                            pw.flush();                             // 3.6.0.2 (2004/10/04)
309                                                    }
310                                            }
311                                    }
312                            }
313                            catch( IOException ex ) {
314                                    String errMsg = "ãƒ??ブル出力時に、IOエラーが発生しましたã€? + toString();
315                                    throw new HybsSystemException( errMsg,ex );             // 3.5.5.4 (2004/04/15) 引数の並びé ?¤‰更
316                            }
317                            finally {
318                                    Closer.ioClose( pw );           // 4.0.0 (2006/01/31) close 処ç�?™‚の IOException を無è¦?
319                                    Closer.ioClose( bt );           // 4.0.0 (2006/01/31) close 処ç�?™‚の IOException を無è¦?
320                            }
321                    }
322    
323                    return(EVAL_PAGE);
324            }
325    
326            /**
327             * タグリブオブジェクトをリリースしますã?
328             * キャãƒ?‚·ュされて再利用されるã?で、フィールドã?初期設定を行いますã?
329             *
330             * @og.rev 2.0.0.4 (2002/09/27) カスタãƒ?‚¿グの release() メソãƒ?ƒ‰をã?追åŠ?
331             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
332             * @og.rev 3.1.3.0 (2003/04/10) FILE_ENCODE から、エンコード情報を取得するã?
333             * @og.rev 3.1.5.0 (2003/04/20) Content-Disposition を外部からæŒ?®šできるように変更ã€?
334             * @og.rev 3.5.4.2 (2003/12/15) EXCELのシート名を指定できるように変更ã€?
335             * @og.rev 3.5.4.3 (2004/01/05) EXCEL雛型参ç?ファイルのURL,filenameを追åŠ?�—ますã?
336             * @og.rev 3.8.5.3 (2006/08/07) writerClass 属æ?の初期値をシスãƒ?ƒ リソースより取得しますã?
337             * @og.rev 3.8.5.3 (2006/08/07) fontName 属æ?を追åŠ?�—ますã?
338             * @og.rev 3.8.5.3 (2006/08/07) fontPoint 属æ?を追åŠ?�—ますã?
339             * @og.rev 3.8.6.0 (2006/08/23) directory 属æ?を追åŠ?�—ますã?
340             * @og.rev 4.0.0.0 (2005/02/28) XMLファイルにセãƒ?ƒˆする、param を追åŠ??
341             * @og.rev 5.2.1.0 (2010/10/01) 書込処ç�?�§コードリソースのラベル変換を行うかどã�?�‹ useRenderer 属æ?追åŠ?
342             * @og.rev 5.5.5.5 (2012/08/24) selectedAll属æ?を追åŠ?
343             * @og.rev 5.5.9.1 (2012/12/07) 事前にファイルを削除するかどã�?�‹。互換性のため、false に設定ã?推奨は、true
344             *
345             */
346            @Override
347            protected void release2() {
348                    super.release2();
349                    separator               = TableWriter.TAB_SEPARATOR;   // é ?›®区åˆ?‚Šæ–?­?
350                    headerSequence  = null;   // ヘッãƒ??é ?›®の並びé ?
351                    fileURL                 = BASE_URL;
352                    filename                = HybsSystem.sys( "FILE_FILENAME" );   // ファイルå�?
353                    beforeDelete    = false;                // 5.5.9.1 (2012/12/07)
354                    refFileURL              = BASE_URL;             // 3.5.4.3 (2004/01/05)
355                    refFilename     = null;                 // 3.5.4.3 (2004/01/05)
356                    fontName                = HybsSystem.sys( "TABLE_WRITER_DEFAULT_FONT_NAME" );                   // 3.8.5.3 (2006/08/07)
357                    fontPoint               = HybsSystem.sys( "TABLE_WRITER_DEFAULT_FONT_POINTS" );                 // 3.8.5.3 (2006/08/07)
358                    encode                  = HybsSystem.sys( "FILE_ENCODE" );       // ファイルエンコーãƒ?‚£ング  "DEFAULT","JISAutoDetect" ,"JIS", "EUC_JP", "MS932", "SJIS" , "Windows-31J" , "Shift_JIS"
359                    writerClass     = HybsSystem.sys( "TABLE_WRITER_DEFAULT_CLASS" );               // 3.8.5.3 (2006/08/07)
360                    fileAppend              = false;   // ファイルをAPPENDモードで出力するか
361                    direct                  = false;
362                    zip                     = false;
363                    table                   = null;
364                    tableId                 = HybsSystem.TBL_MDL_KEY ;
365                    disposition     = "attachment";         // 3.8.0.9 (2005/10/17) 初期値変更 inline â‡?attachment
366                    sheetName               = "Sheet1";             // 3.5.4.2 (2003/12/15)
367                    refSheetName    = null;                 // 3.5.4.2 (2003/12/15)
368                    param                   = null ;                // 4.0.0 (2005/01/31)
369                    useNumber               = true;                 // 3.7.0.2 (2005/02/14)
370                    directory               = null;                 // 3.8.6.0 (2006/08/23)
371                    columns                 = null;                 // 4.0.0 (2005/12/31)
372                    useRenderer             = HybsSystem.sysBool( "USE_TABLE_WRITER_RENDERER" );    // 5.2.1.0 (2010/10/01)
373                    selectedAll             = true;                 // 5.5.5.5 (2012/08/24)
374            }
375    
376            /**
377             * TableWriter の実オブジェクトを生æ?して??del>PrintWriter</del>OutputStream に書き込みますã?
378             *
379             * @og.rev 3.5.4.1 (2003/12/01) 引数の PrintWriter をã?OutputStream に変更ã€?
380             * @og.rev 3.5.4.2 (2003/12/15) lang 引数ã‚?table と同時に設定しますã?
381             * @og.rev 3.5.4.2 (2003/12/15) TableWriter のサブクラス名変更ã€?
382             * @og.rev 3.5.4.3 (2004/01/05) EXCEL雛型参è?ファイルを指定するよã�?�«変更ã€?
383             * @og.rev 3.5.4.3 (2004/01/05) 引数をã? PrintWriter に戻すã?
384             * @og.rev 3.5.4.5 (2004/01/23) æ–?­—エンコードを渡すよã�?�«変更するã€?
385             * @og.rev 3.5.6.0 (2004/06/18) å�?¨®プラグイン関連付け設定を、シスãƒ?ƒ パラメータ に記述しますã?
386             * @og.rev 3.8.5.3 (2006/08/07) EXCEL時に fontName と fontPoint 属æ?をセãƒ?ƒˆしますã?
387             * @og.rev 4.0.0.0 (2005/01/31) キーのæŒ?®šを、TableWriter. から、TableWriter_ に変更しますã?
388             * @og.rev 4.0.0.0 (2005/12/31) 外部よりカラãƒ??(カンマ区åˆ?‚Š)を指定できるようにするã€?
389             * @og.rev 5.2.1.0 (2010/10/01) 書込処ç�?�§コードリソースのラベル変換を行うかどã�?�‹設å®?useRenderer 属æ?追åŠ?
390             *
391             * @param   out PrintWriterオブジェクãƒ?
392             */
393            private void create( final PrintWriter out )  {
394                    // 5.2.1.0 (2010/10/01) writerClass で Renderer系の場合ã?、useRendererフラグに変更するã€?
395                    if( "ExcelRenderer".equalsIgnoreCase( writerClass ) ) {
396                            writerClass = "Excel" ;
397                            useRenderer = true;
398                    }
399                    else if( "Renderer".equalsIgnoreCase( writerClass ) ) {
400                            writerClass = "Default" ;
401                            useRenderer = true;
402                    }
403    
404                    String className = HybsSystem.sys( "TableWriter_" + writerClass ) ;             // 4.0.0 (2005/01/31)
405                    TableWriter writer = (TableWriter)HybsSystem.newInstance( className );  // 3.5.5.3 (2004/04/09)
406    
407                    writer.setDBTableModel( table,getLanguage() );
408                    writer.setSeparator( separator );
409                    writer.setHeaderSequence( headerSequence );
410                    writer.setEncode( encode );                                     // 3.5.4.5 (2004/01/23)
411                    writer.setAppend( fileAppend );                         // 3.5.4.2 (2003/12/15)
412                    if( param != null ) { writer.setParam( param ); }       // 4.0.0 (2005/01/31)
413                    writer.setUseNumber( useNumber );                       // 3.7.0.2 (2005/02/14)
414            //      if( columns == null ) {
415            //              columns = (String)getSessionAttribute( HybsSystem.TBL_WRITER_CLMS );
416            //              removeSessionAttribute( HybsSystem.TBL_WRITER_CLMS );
417            //      }
418                    writer.setColumns( columns );                           // 4.0.0 (2005/12/31)
419                    writer.setUseRenderer( useRenderer );           // 5.2.1.0 (2010/10/01)
420                    if( writer.isExcel() ) {                                        // 3.5.4.3 (2004/01/05)
421                            writer.setSheetName( sheetName );
422                            writer.setFilename( StringUtil.urlAppend( directory , filename ) );
423                            if( refFileURL != null && refFilename != null ) {
424                                    writer.setRefFilename( StringUtil.urlAppend( HybsSystem.url2dir(refFileURL) , refFilename ) );
425                            }
426                            writer.setRefSheetName( refSheetName );
427                            writer.setFontName( nval( fontName,null ) );                    // 3.8.5.3 (2006/08/07)
428                            if( fontPoint != null && fontPoint.length() > 0 ) {
429                                    writer.setFontPoint( Short.parseShort( fontPoint ) );   // 3.8.5.3 (2006/08/07)
430                            }
431                            writer.writeDBTable();
432                    }
433                    else {
434                            writer.writeDBTable( out );
435                    }
436            }
437    
438            /**
439             * PrintWriter を取得しますã?
440             *
441             * ここでは、ä¸?ˆ¬çš?�ªファイル出力をè€??した PrintWriter を作æ?しますã?
442             *
443             * @og.rev 2.2.0.0 (2002/12/17) 中国èª?国際化)対å¿?エンコードã?取得方法変更
444             * @og.rev 3.1.3.0 (2003/04/10) FILE_ENCODE から、エンコード情報を取得するã?
445             * @og.rev 3.5.4.1 (2003/12/01) PrintWriter をã?OutputStream に変更ã€?
446             * @og.rev 3.5.5.9 (2004/06/07) FileUtil.getBufferedReader を使用
447             * @og.rev 3.7.1.1 (2005/05/23) フォルãƒ?�Œなã�??合ã?、è¤?•°階層åˆ??フォルãƒ?‚’自動で作æ?しますã?
448             * @og.rev 3.8.0.0 (2005/06/07) FileUtil#getPrintWriter を利用ã€?
449             *
450             * @return      ファイル書きå?し用のPrintWriterオブジェクãƒ?
451             */
452            private PrintWriter getPrintWriter() {
453                    if( filename == null ) {
454                            String errMsg = "ファイル名がセãƒ?ƒˆされてã�?�¾せんã€?;
455                            throw new HybsSystemException( errMsg );
456                    }
457    
458                    // ※ 注æ„?StringUtil.urlAppend をçµ?�¿込んでã�?‚‹意図が不æ?。ä¸?—¦削除してã�?�¾すが、注æ„?
459                    // 3.8.0.0 (2005/06/07) FileUtil#getPrintWriter を利用ã€?
460            //      out = FileUtil.getPrintWriter( StringUtil.urlAppend( directory,filename ),fileAppend,encode);
461                    PrintWriter out = FileUtil.getPrintWriter( new File( directory,filename ),encode,fileAppend );
462    
463                    return out ;
464            }
465    
466            /**
467             * PrintWriter を取得しますã?
468             *
469             * 引数でæŒ?®šしたOutputStreamを利用して出力しますã?
470             *
471             * @og.rev 5.5.2.0 (2012/05/01) 新規作æ?
472             *
473             * @param       os      OutputStreamオブジェクãƒ?
474             *
475             * @return      æŒ?®šしたstreamに書きå?すPrintWriter
476             */
477            private PrintWriter getPrintWriter( final OutputStream os ) {
478                    PrintWriter out = FileUtil.getPrintWriter( os,encode );
479    
480                    return out ;
481            }
482            
483            /**
484             * チェãƒ?‚¯åˆ??ãƒ??ブルモãƒ?ƒ«をå?構æ?しますã?
485             *
486             * @og.rev 5.5.5.5 (2012/08/24) 新規作æ?
487             * @og.rev 5.5.9.1 (2012/12/07) å†?ƒ¨処ç�?¤‰更
488             *
489             * @param       oldTable        コピã?å…?ƒ†ーブルモãƒ?ƒ«
490             *
491             * @return      チェãƒ?‚¯したåˆ?� けで再構æ?したãƒ??ブルモãƒ?ƒ«
492             */
493            private DBTableModel getSelRowsTable( final DBTableModel oldTable ) {
494                    if( oldTable == null ) { return null; }         // 5.5.9.1 (2012/12/07) 引数のDBTableModelã�?null の場合ã?処ç�??
495    
496                    DBTableModel newTable = oldTable.newModel();
497                    final int[] rowNo = getParameterRows();
498                    final int rowCount = rowNo.length ;
499    //              if( rowCount > 0 ) { // 5.5.9.1 (2012/12/07) 不要ã?for ループ中に、rowCount==0は、何もしなã�?º‹が含まれてã�?‚‹ã€?
500                            for( int i=0; i<rowCount; i++ ) {
501                                    newTable.addValues( oldTable.getValues(rowNo[i]), i );
502                            }
503    //              }
504                    return newTable;
505            }
506    
507            /**
508             * 【TAGã€?通常使ã�?�¾せん)sessionからæ‰?¾—すã‚?DBTableModelオブジェクトã? IDã€?
509             *
510             * @og.tag
511             * 表示処ç�?¾Œに??å†?ƒ¨ポインタを書き換えた)DBTableModelオブジェクトを
512             * 同じキーで、sessionに登録しますã?
513             * 初期値は、HybsSystem.TBL_MDL_KEY ですã?
514             *
515             * @param   tableId sessionに登録する時ã? ID
516             */
517            public void setTableId( final String tableId ) {
518                    this.tableId = nval( getRequestParameter( tableId ), this.tableId );
519            }
520    
521            /**
522             * 【TAG】可変長ファイルを作æ?するときã?é ?›®区åˆ?‚Šæ–?­—をセãƒ?ƒˆしまã�?
523             *              (初期値:TableWriter#TAB_SEPARATOR[={@og.value TableWriter#TAB_SEPARATOR}])ã€?
524             *
525             * @og.tag 可変長ファイルを作æ?するときã?é ?›®区åˆ?‚Šæ–?­—をセãƒ?ƒˆしますã?
526             * (初期値:TableWriter#TAB_SEPARATOR[={@og.value TableWriter#TAB_SEPARATOR}])ã€?
527             *
528             * @param   separator é ?›®区åˆ?‚Šæ–?­?
529             * @see         org.opengion.hayabusa.io.TableWriter#TAB_SEPARATOR
530             */
531            public void setSeparator( final String separator ) {
532                    this.separator = nval( getRequestParameter( separator ),this.separator );
533            }
534    
535            /**
536             * 【TAG】DBTableModelの出力é?(LNSCD など)をセãƒ?ƒˆしますã?
537             *
538             * @og.tag
539             * Label,Name,Size,Class,Data のå�?ƒ•ィールドã?頭æ–?­—ã?アルファベットで
540             * 出力é?を設定しますã?
541             *
542             * @param   hs 出力é? (LNSCD など)
543             */
544            public void setHeaderSequence( final String hs ) {
545                    String[] headers = getRequestParameterValues( hs );
546                    if( headers != null ) {
547                            StringBuilder buf = new StringBuilder();
548                            for( int i=0; i<headers.length; i++ ) {
549                                    if( headers[i] != null ) { buf.append( headers[i] ); }
550                            }
551                            headerSequence = buf.toString();
552                    }
553            }
554    
555            /**
556             * 【TAG】EXCEL雛型参ç?ファイルのãƒ?‚£レクトリ名をセãƒ?ƒˆしますã?
557             *
558             * @og.tag
559             * こã?属æ?でæŒ?®šされるãƒ?‚£レクトリに、ファイルをセーブしますã?
560             * æŒ?®š方法ã?ã€??常の fileURL 属æ?と同様に、å?頭がã?'/' (UNIX) またã?ã€?¼’文字目がã?
561             * ":" (Windows)の場合ã?、指定ã?URLそã?ままのãƒ?‚£レクトリに、そã�?�§なã�??合ã?ã€?
562             * シスãƒ?ƒ パラメータ の FILE_URL 属æ?でæŒ?®šã?フォルãƒ??下に、作æ?されますã?
563             * fileURL = "{&#064;USER.ID}" とæŒ?®šすると、FILE_URL 属æ?でæŒ?®šã?フォルãƒ??下にã€?
564             * さらに、各個人ID別のフォルãƒ?‚’作æ?して、そこにセーブしますã?
565             *
566             * @og.rev 3.5.4.3 (2004/01/05) 新規作æ?
567             * @og.rev 4.0.0.0 (2005/01/31) StringUtil.urlAppend メソãƒ?ƒ‰の利用
568             * @og.rev 4.0.0.0 (2007/11/20) æŒ?®šされたãƒ?‚£レクトリ名ã?æœ?¾Œが"\"or"/"で終わってã�?�ªã�??合にã€?/"を付加するã€?
569             *
570             * @param       url EXCEL雛型参ç?ファイルのãƒ?‚£レクトリå�?
571             */
572            public void setRefFileURL( final String url ) {
573                    String furl = nval( getRequestParameter( url ),null );
574                    if( furl != null ) {
575                            char ch = furl.charAt( furl.length()-1 );
576                            if( ch != '/' && ch != '\\' ) { furl = furl + "/"; }
577                            refFileURL = StringUtil.urlAppend( refFileURL,furl );
578                    }
579            }
580    
581            /**
582             * 【TAG】ファイル保存å?ãƒ?‚£レクトリ名をæŒ?®šしますã?
583             *
584             * @og.tag
585             * こã?属æ?でæŒ?®šされるãƒ?‚£レクトリに、ファイルをセーブしますã?
586             * æŒ?®š方法ã?ã€??常の fileURL 属æ?と同様に、å?頭がã?'/' (UNIX) またã?ã€?¼’文字目がã?
587             * ":" (Windows)の場合ã?、指定ã?URLそã?ままのãƒ?‚£レクトリに、そã�?�§なã�??合ã?ã€?
588             * シスãƒ?ƒ パラメータ の FILE_URL 属æ?でæŒ?®šã?フォルãƒ??下に、作æ?されますã?
589             * fileURL = "{&#064;USER.ID}" とæŒ?®šすると、FILE_URL 属æ?でæŒ?®šã?フォルãƒ??下にã€?
590             * さらに、各個人ID別のフォルãƒ?‚’作æ?して、そこにセーブしますã?
591             *
592             * @og.rev 3.5.4.3 (2004/01/05) å†?ƒ¨処ç�?‚’、makeFileURL に移動ã?
593             * @og.rev 4.0.0.0 (2005/01/31) StringUtil.urlAppend メソãƒ?ƒ‰の利用
594             * @og.rev 4.0.0.0 (2007/11/20) æŒ?®šされたãƒ?‚£レクトリ名ã?æœ?¾Œが"\"or"/"で終わってã�?�ªã�??合にã€?/"を付加するã€?
595             *
596             * @param       url 保存å?ãƒ?‚£レクトリå�?
597             */
598            public void setFileURL( final String url ) {
599                    String furl = nval( getRequestParameter( url ),null );
600                    if( furl != null ) {
601                            char ch = furl.charAt( furl.length()-1 );
602                            if( ch != '/' && ch != '\\' ) { furl = furl + "/"; }
603                            fileURL = StringUtil.urlAppend( fileURL,furl );
604                    }
605            }
606    
607            /**
608             * 【TAG】ファイルを作æ?するときã?ファイル名をセãƒ?ƒˆしまã�?
609             *              (初期値:FILE_ENCODE[={@og.value org.opengion.hayabusa.common.SystemData#FILE_ENCODE}])ã€?
610             *
611             * @og.tag ファイルを作æ?するときã?ファイル名をセãƒ?ƒˆしますã?
612             * (初期値:シスãƒ?ƒ 定数のFILE_ENCODE[={@og.value org.opengion.hayabusa.common.SystemData#FILE_ENCODE}])ã€?
613             *
614             * @param   filename ファイルå�?
615             * @see         org.opengion.hayabusa.common.SystemData#FILE_ENCODE
616             */
617            public void setFilename( final String filename ) {
618                    this.filename = nval( getRequestParameter( filename ),this.filename );
619            }
620    
621            /**
622             * 【TAG】EXCEL雛型参è?ファイル名をセãƒ?ƒˆしますã?
623             *
624             * @og.tag EXCEL雛型参è?ファイル名をセãƒ?ƒˆしますã?
625             *
626             * @og.rev 3.5.4.3 (2004/01/05) 新規作æ?
627             *
628             * @param   filename EXCEL雛型参è?ファイルå�?
629             */
630            public void setRefFilename( final String filename ) {
631                    refFilename = nval( getRequestParameter( filename ),refFilename );
632            }
633    
634            /**
635             * 【TAG】ファイルを作æ?するときã?ファイルエンコーãƒ?‚£ング名をセãƒ?ƒˆしまã�?
636             *              (初期値:FILE_ENCODE[={@og.value org.opengion.hayabusa.common.SystemData#FILE_ENCODE}])ã€?
637             *
638             * @og.tag
639             * "DEFAULT","JISAutoDetect" ,"JIS", "EUC_JP", "MS932", "SJIS" , "Windows-31J" , "Shift_JIS"
640             * (初期値:シスãƒ?ƒ 定数のFILE_ENCODE[={@og.value org.opengion.hayabusa.common.SystemData#FILE_ENCODE}])ã€?
641             *
642             * @og.rev 2.2.0.0 (2002/12/17) 中国èª?国際化)対å¿?エンコードã?取得方法変更
643             * @og.rev 3.1.3.0 (2003/04/10) FILE_ENCODE から、エンコード情報を取得するã?
644             *
645             * @param   enc ファイルエンコーãƒ?‚£ングå�?
646             * @see     <a href="http://www.iana.org/assignments/character-sets">IANA Charset Registry</a>
647             * @see         org.opengion.hayabusa.common.SystemData#FILE_ENCODE
648             */
649            public void setEncode( final String enc ) {
650                    encode = nval( getRequestParameter( enc ),encode );
651            }
652    
653            /**
654             * 【TAG】実際に書きå?すクラス名ã?略称({@og.doc03Link writerClass TableWriter_**** クラスの ****})を指定しまã�?初期値:Default)ã€?
655             *
656             * @og.tag
657             * 実際に書きå?すクラスå�?の略称)をセãƒ?ƒˆしますã?
658             * これは、org.opengion.hayabusa.io 以下ã? TableWriter_**** クラスの **** ã‚?
659             * 与えますã?これらã?、TableWriter インターフェースを継承したサブクラスですã?
660             * 属æ?クラス定義の {@link org.opengion.hayabusa.io.TableWriter TableWriter} を参照願いますã?
661             * {@og.doc03Link writerClass TableWriter_**** クラス}
662             *
663             * @param   writerClass クラスå�?の略称)
664             * @see         org.opengion.hayabusa.io.TableWriter  TableWriterのサブクラス
665             */
666            public void setWriterClass( final String writerClass ) {
667                    this.writerClass = nval( getRequestParameter( writerClass ),this.writerClass );
668            }
669    
670            /**
671             * 【TAG】追åŠ?ƒ¢ードで書き込ã‚?�‹どã�?�‹[true/false]を指定しまã�?初期値:false[新規モード])ã€?
672             *
673             * @og.tag DBTableModelのファイルをã?追åŠ?ƒ¢ードで書き込ã‚?�‹どã�?�‹をセãƒ?ƒˆしますã?
674             *
675             * @param   flag  [true:追åŠ?ƒ¢ーãƒ?それ以å¤?新規モード]
676             */
677            public void setFileAppend( final String flag ) {
678                    fileAppend = nval( getRequestParameter( flag ),fileAppend );
679            }
680    
681            /**
682             * 【å»?­¢】結果をダイレクトにEXCEL起動するかどã�?�‹[true/false]を指定しまã�?初期値:false[ファイル])ã€?
683             *
684             * @og.tag 結果をダイレクトに EXCEL ファイルとして出力するかどã�?�‹をセãƒ?ƒˆしますã?
685             *
686             * @param  flag  [true:ãƒ?‚¤レクãƒ?それ以å¤?ファイル]
687             * @deprecated 結果をダイレクトするとエンコード等でおかしな動きをする可能性があるã?
688             */
689            @Deprecated public void setDirect( final String flag ) {
690                    direct = nval( getRequestParameter( flag ),direct );
691            }
692    
693            /**
694             * 【TAG】結果をファイルに出力するときに、ZIPで圧縮するかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
695             *
696             * @og.tag
697             * 初期値は、圧縮しなã�?�§すã?
698             *
699             * @param  flag ZIPで圧縮する [true:圧縮する/それ以å¤?しない]
700             */
701            public void setZip( final String flag ) {
702                    zip = nval( getRequestParameter( flag ),zip );
703            }
704    
705            /**
706             * 【TAG】Content-Disposition (inline:埋め込ã‚?attachment:ãƒ?‚¤アログを起å‹?を指定しまã�?初期値:attachment)ã€?
707             *
708             * @og.tag
709             * Content-Disposition を指定することで、ブラウザにアプリケーションãƒ??タã‚?
710             * 埋め込ã‚??ã�?inline)、セーãƒ?オープンのãƒ?‚¤アログを起動するã?ã�?attachment)
711             * æŒ?®šしますã?
712             * こã?属æ?が有効なのは、direct="true" で、zip="false"(初期値)のときã?みですã?
713             * 値は、inline 、attachment が指定できますã?
714             * 初期値は、attachment ですã?
715             * 注意:動作検証しましたがã?inline と attachment で動作に差が現れませんでしたã€?
716             *
717             * @og.rev 3.1.5.0 (2003/04/20) Content-Disposition を外部からæŒ?®šできるように変更ã€?
718             * @og.rev 3.8.0.9 (2005/10/17) Content-Disposition 初期値変更 inline â‡?attachment
719             *
720             * @param  pos Content-Disposition [inline/attachment]
721             */
722            public void setDisposition( final String pos ) {
723                    disposition = nval( getRequestParameter( pos ),disposition );
724                    if( !"inline".equals( disposition ) && !"attachment".equals( disposition ) ) {
725                            String errMsg = "disposition には、inline ã�?attachment 以外ã?æŒ?®šできませんã€?
726                                                    + "disposition=[" + disposition + "]" ;
727                            throw new HybsSystemException( errMsg );
728                    }
729            }
730    
731            /**
732             * 【TAG】EXCELファイルを書きå?すときã?シート名を設定しますã?
733             *
734             * @og.tag
735             * EXCELファイルを書きå?す時に、シート名を指定しますã?これにより、è¤?•°の形式ã?
736             * 異なるデータをé?次書きå?したã‚?appendモードを併用)することã‚??シートをæŒ?®šして
737             * 新規にEXCELを作æ?することが可能になりますã?
738             * 初期値は、Sheet1 ですã?
739             *
740             * @og.rev 3.5.4.2 (2003/12/15) 新規追åŠ?
741             *
742             * @param   sheet EXCELファイルのシート名
743             */
744            public void setSheetName( final String sheet ) {
745                    sheetName = nval( getRequestParameter( sheet ),sheetName );
746            }
747    
748            /**
749             * 【TAG】EXCEL雛型参è?ファイルのシート名を設定しますã?
750             *
751             * @og.tag
752             * EXCELファイルを書きå?す時にã€?››型として参ç?するシート名を指定しますã?
753             * これにより、è¤?•°の形式ã?異なるデータをé?次書きå?したã‚?appendモードを併用)する
754             * ことã‚??シートをæŒ?®šして新規にEXCELを作æ?する場合にフォーãƒ?‚’設定する事が可能になりますã?
755             * 初期値は、null(第ä¸?‚·ーãƒ? ですã?
756             *
757             * @og.rev 3.5.4.3 (2004/01/05) 新規追åŠ?
758             *
759             * @param   sheet EXCEL雛型参è?ファイルのシート名
760             */
761            public void setRefSheetName( final String sheet ) {
762                    refSheetName = nval( getRequestParameter( sheet ),refSheetName );
763            }
764    
765            /**
766             * 【TAG】EXCEL出力時のãƒ?ƒ•ォルトフォント名を設定しまã�?
767             *              (初期値:TABLE_WRITER_DEFAULT_FONT_NAME[={@og.value org.opengion.hayabusa.common.SystemData#TABLE_WRITER_DEFAULT_FONT_NAME}])ã€?
768             *
769             * @og.tag
770             * これは、EXCEL追åŠ?©Ÿè?として実è£?�•れてã�?�¾すã?
771             *
772             * EXCELファイルを書きå?す時に、デフォルトフォント名を指定しますã?
773             * フォント名は、EXCELのフォント名をそのまま使用してくださいã€?
774             * å†?ƒ¨çš?�«、POI の org.apache.poi.hssf.usermodel.HSSFFont#setFontName( String )
775             * に設定されますã?
776             * (初期値:シスãƒ?ƒ 定数のTABLE_WRITER_DEFAULT_FONT_NAME[={@og.value org.opengion.hayabusa.common.SystemData#TABLE_WRITER_DEFAULT_FONT_NAME}])ã€?
777             *
778             * @og.rev 3.8.5.3 (2006/08/07) 新規追åŠ?
779             *
780             * @param   name ãƒ?ƒ•ォルトフォント名
781             * @see         org.opengion.hayabusa.common.SystemData#TABLE_WRITER_DEFAULT_FONT_NAME
782             */
783            public void setFontName( final String name ) {
784                    fontName = nval( getRequestParameter( name ),fontName );
785            }
786    
787            /**
788             * 【TAG】EXCEL出力時のãƒ?ƒ•ォルトフォントã?イント数を設定しますã?
789             *
790             * @og.tag
791             * これは、EXCEL追åŠ?©Ÿè?として実è£?�•れてã�?�¾すã?
792             *
793             * EXCELファイルを書きå?す時に、デフォルトã?イント数を指定しますã?
794             * å†?ƒ¨çš?�«、POI の org.apache.poi.hssf.usermodel.HSSFFont#setFontHeightInPoints( short )
795             * に設定されますã?
796             * 初期値は、シスãƒ?ƒ リソース の TABLE_WRITER_DEFAULT_FONT_POINTS ですã?
797             *
798             * @og.rev 3.8.5.3 (2006/08/07) 新規追åŠ?
799             *
800             * @param   point ãƒ?ƒ•ォルトフォントã?イント数
801             */
802            public void setFontPoint( final String point ) {
803                    fontPoint = nval( getRequestParameter( point ),fontPoint );
804            }
805    
806            /**
807             * 【TAG】行番号æƒ??をã?出力すã‚?しない[true/false]を指定しまã�?初期値:true)ã€?
808             *
809             * @og.tag
810             * 通常のフォーマットでは、各行ã?先é?に行番号をå?力しますã?
811             * これはã€?NAME 属æ?を使用する場合には、å¿?�š出力するå¿?¦�がありますã?
812             * (#NAME 属æ?は、読み取り時には、å¿??ですã?)
813             * こã?、å?頭の行番号が不要な場å�?つまりã?他ã?シスãƒ?ƒ へのãƒ??タ出力ã?
814             * こã?シスãƒ?ƒ ではã€?NAME 属æ?がå?力されなã�?�Ÿめã?読み込みできませんã€?
815             * こã?行番号をå?力しなã�?‚ˆã�?�«できますã?
816             * なおã?EXCEL 出力には、この設定ã?適用されませんã€?暫定対å¿?
817             * 初期値は、true(出力すã‚? ですã?
818             *
819             * @og.rev 3.7.0.2 (2005/02/14) 新規追åŠ?
820             *
821             * @param   useNo 行番号æƒ??を指å®?[true:出力すã‚?false:しない]
822             */
823            public void setUseNumber( final String useNo ) {
824                    useNumber = nval( getRequestParameter( useNo ),useNumber );
825            }
826    
827            /**
828             * 【TAG】書き込み先ファイルのカラãƒ??をã?外部(タグ)よりæŒ?®šしますã?
829             *
830             * @og.tag
831             * こã?æŒ?®šにより、書き込ã‚?‚«ラãƒ?‚’限定的に使用することが可能ですã?
832             * カラãƒ?��は、検索したDBTableModel上に含まれる名前でæŒ?®šするå¿?¦�がありますã?
833             * 別名で書き込みたい場合ã?、予めそã?名前で検索しておくå¿?¦�がありますã?
834             *
835             * @og.rev 4.0.0.0 (2005/12/31) 新規作æ?
836             *
837             * @param   clms 書き込み先ファイルのカラãƒ??(カンマ区åˆ?‚Šæ–?­?
838             */
839            public void setColumns( final String clms ) {
840                    columns = nval( getRequestParameter( clms ),columns );
841            }
842    
843            /**
844             * 【TAG】書込処ç�?�§コードリソースのラベル変換を行うかどã�?�‹を指定しまã�?
845             *              (初期値:USE_TABLE_WRITER_RENDERER[={@og.value org.opengion.hayabusa.common.SystemData#USE_TABLE_WRITER_RENDERER}])ã€?
846             *
847             * @og.tag
848             * コードリソースをそのままの値で出力すると、数字や記号になり何が書かれてã�?‚‹のã�?
849             * 不æ?になりますã?
850             * これは、コードリソースをラベルに変換して出力するかどã�?�‹を指定しますã?
851             * 当然、コードã?ユニã?クですが、ラベルはユニã?クになるかどã�?�‹保障はされてã�?�¾せんので
852             * TableReader 系で読み込ã‚??合には、リスクが発生しますã?
853             * またã?TableReader 系で読み込ã‚??合にもã?ラベルからコードを求めるé?変換を行うようにã€?
854             * setUseRenderer メソãƒ?ƒ‰でæŒ?®šするå¿?¦�がありますã?
855             *
856             * 従来は、TableWriter 系に、TableWriter_Renderer 系のクラスを作って対応してã�?�¾したがã?
857             * こã?メソãƒ?ƒ‰の属æ?値のフラグで、制御しますã?
858             * (初期値:シスãƒ?ƒ 定数のUSE_TABLE_WRITER_RENDERER[={@og.value org.opengion.hayabusa.common.SystemData#USE_TABLE_WRITER_RENDERER}])ã€?
859             *
860             * @og.rev 5.2.1.0 (2010/10/01) 新規作æ?
861             *
862             * @param  flag コードリソースのラベル変換を行うかどã�?�‹
863             * @see         org.opengion.hayabusa.common.SystemData#USE_TABLE_WRITER_RENDERER
864             */
865            public void setUseRenderer( final String flag ) {
866                    useRenderer = nval( getRequestParameter( flag ),useRenderer );
867            }
868            
869            /**
870             * 【TAG】チェãƒ?‚¯行ã?みを対象にするかをæŒ?®šしまã�?初期値:true)ã€?
871             *
872             * @og.tag
873             * falseを指定する事で、前画面でチェãƒ?‚¯した行ã?みをå?力しますã?
874             * 初期値は全ての行を出åŠ?true)ですã?
875             * 出力されるファイルの行番号はã€?から振りなおされますã?
876             *
877             * @og.rev 5.5.5.5 (2012/08/24) 新規作æ?
878             *
879             * @param   flag 対象にするか指å®?[true:全件/false:対象のみ]
880             */
881            public void setSelectedAll( final String flag ) {
882    //              selectedAll = nval( getRequestParameter( flag ),useNumber );
883                    selectedAll = nval( getRequestParameter( flag ),selectedAll );          // 5.5.9.1 (2012/12/07) バグ対å¿?
884            }
885            
886            /**
887             * 【TAG】事前にファイルを削除するかどã�?�‹を指定しまã�?初期値:false)ã€?
888             *
889             * @og.tag
890             * 出力å?の DBTableModel がã?存在しなã�?�‹ã€?¼�件の場合ã?過去に作æ?したファイルã�?
891             * そã?まま、残ってã�?‚‹と、不要なトラブルのもととなる為、実行前に削除するã�?
892             * どã�?�‹を指定できますã?
893             * なおã?fileAppend="true"?ˆ追åŠ?ƒ¢ードで書き込ã‚?‚’æŒ?®?時には、データが0件でã‚?
894             * 事前削除は行いませんã€?
895             * 初期値は互換性のため削除しなã�?false)ですã?
896             *
897             * @og.rev 5.5.9.1 (2012/12/07) 新規作æ?
898             *
899             * @param   flag 事前削除するかどã�?�‹ [true:削除する/false:削除しない]
900             */
901            public void setBeforeDelete( final String flag ) {
902                    beforeDelete = nval( getRequestParameter( flag ),beforeDelete );
903            }
904    
905            /**
906             * WriteTable オブジェクトに渡すパラメータオブジェクトをセãƒ?ƒˆしますã?
907             *
908             * @og.tag
909             * WriteTableParamTag クラスよりセãƒ?ƒˆされますã?
910             *
911             * @og.rev 4.0.0.0 (2005/02/28) 新規追åŠ?
912             *
913             * @param   entry HybsEntryオブジェクãƒ?
914             */
915            protected void addParam( final HybsEntry entry ) {
916                    if( param == null ) { param = new ArrayList<HybsEntry>(); }
917                    param.add( entry );
918            }
919    
920            /**
921             * シリアライズ用のカスタãƒ?‚·リアライズ書き込みメソãƒ?ƒ‰
922             *
923             * @og.rev 4.0.0.0 (2006/09/31) 新規追åŠ?
924             * @serialData
925             *
926             * @param       strm    ObjectOutputStreamオブジェクãƒ?
927             */
928            private void writeObject( final ObjectOutputStream strm ) throws IOException {
929                    strm.defaultWriteObject();
930            }
931    
932            /**
933             * シリアライズ用のカスタãƒ?‚·リアライズ読み込みメソãƒ?ƒ‰
934             *
935             * ここでは、transient 宣è¨?�•れたå†?ƒ¨変数のå†??初期化がå¿?¦�なフィールドã?み設定しますã?
936             *
937             * @og.rev 4.0.0.0 (2006/09/31) 新規追åŠ?
938             * @serialData
939             *
940             * @param       strm    ObjectInputStreamオブジェクãƒ?
941             * @see #release2()
942             */
943            private void readObject( final ObjectInputStream strm ) throws IOException , ClassNotFoundException {
944                    strm.defaultReadObject();
945            }
946    
947            /**
948             * こã?オブジェクトã?æ–?­—å?表現を返しますã?
949             * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
950             *
951             * @return こã?クラスのæ–?­—å?表現
952             */
953            @Override
954            public String toString() {
955                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
956                                    .println( "VERSION"                     ,VERSION                )
957                                    .println( "BASE_URL"            ,BASE_URL               )
958                                    .println( "separator"           ,separator              )
959                                    .println( "headerSequence"      ,headerSequence )
960                                    .println( "fileURL"                     ,fileURL                )
961                                    .println( "filename"            ,filename               )
962                                    .println( "refFileURL"          ,refFileURL             )
963                                    .println( "refFilename"         ,refFilename    )
964                                    .println( "encode"                      ,encode                 )
965                                    .println( "writerClass"         ,writerClass    )
966                                    .println( "fileAppend"          ,fileAppend             )
967                                    .println( "direct"                      ,direct                 )
968                                    .println( "zip"                         ,zip                    )
969                                    .println( "disposition"         ,disposition    )
970                                    .println( "tableId"                     ,tableId                )
971                                    .println( "sheetName"           ,sheetName              )
972                                    .println( "refSheetName"        ,refSheetName   )
973                                    .println( "useNumber"           ,useNumber              )
974                                    .println( "Other..."    ,getAttributes().getAttribute() )
975                                    .fixForm().toString() ;
976            }
977    }