Groups
Groups
Sign in
Groups
Groups
excella
Conversations
About
Send feedback
Help
不要な改ページが挿入される。
892 views
Skip to first unread message
Message has been deleted
あずり
unread,
Mar 20, 2011, 7:21:15 AM
3/20/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to excella
お世話になっております。戸田です。
定型の行数が決まっているExcelファイルを出力する際に、不要な改ページが挿入されてしまいます。
以下、詳細です。
①同じシート内に内訳書(鑑部)と内訳書(明細部)があるテンプレートを作成。鑑部と明細部は定型の行数が決まっている(それぞれ、19行と15行)テ
ンプレートには改ページを設定。
②内訳書(明細部)は、$BRで繰り返し出力される。
③出力前に、ReportProcessListenerを実装したListenerクラスを作成し、 postBookParseメソッド内で改
ペー
ジの設定を行っている。
==============================================================
// 改ページを設定するシートの取得
Sheet sheet = arg0.getSheetAt(0);
// テンプレートに設定している改ページを削除する
sheet.removeRowBreak(13 - 1);
sheet.removeColumnBreak(16);
// 行数を取得
int rowCount = sheet.getLastRowNum() + 1;
// 行数から鑑部の定型行数を引いた数を求める。
int rowNum = rowCount - 19;
// 改ページを挿入する回数を求める
int repeatBreak = (rowNum / 15) + 1;
//列位置を指定して改ページ
sheet.setColumnBreak(16);
//行位置を指定して改ページ
for(int i = 1; i<=repeatBreak; i++){
if(i == 1){
// 鑑部の改ページ
sheet.setRowBreak(19 - 1);
}else{
// 内訳書の改ページ
sheet.setRowBreak((19 + (15 * (i-1))));
}
}
// シート位置指定
arg0.setFirstVisibleTab(0);
==============================================================
上記の通り処理を行ったところ、出力されたExcelファイルに上記の処理以外の余分な改ページが設定されていました。(5行分)
ちなみに、上記のメソッドの中でgetRowBreaks()で改ページを設定している行番号を全て出力してみたのですが、余分な改ページの分は出力さ
れませんでした。
テンプレート側の問題か或いはPOIの問題かを切り分けたいので、お手数ですがご回答宜しくお願い致します。
Reply all
Reply to author
Forward
0 new messages