複数ページの印刷を行うとき、ページをまたぐ行が正しく印刷されない
対象製品
MultiRow for Windows Forms 5.0J
状況
修正済み
詳細
.NET FrameworkのPrintDocumentクラスを使用して、2ページ以上の印刷を行うとき、ページをまたぐ行が途中で切れた状態で印刷されてしまいます。
回避方法
この現象はService Pack 2(v5.0.2011.0513)で修正されています。
最新のService Packのダウンロードはこちら 。
または、DefaultPageSettings.Marginsプロパティのbottomに対して、ページの用紙サイズと印刷可能領域から計算した値を設定することで回避することが可能です。
なお、設定する値は用紙の向きによって、以下のように変更する必要があります。
[Visual Basic]
' 印刷の設定
Dim temp As New PrintDocument
'------------------------------------------------
'最後の行が印刷されない現象の回避方法
Dim bottom As Integer
'用紙が横向きの場合
temp.DefaultPageSettings.Landscape = True
bottom = temp.DefaultPageSettings.PaperSize.Width - temp.DefaultPageSettings.PrintableArea.Width + 1
''用紙が縦向きの場合
'temp.DefaultPageSettings.Landscape = False
'bottom = temp.DefaultPageSettings.PaperSize.Height - temp.DefaultPageSettings.PrintableArea.Height + 1
temp.DefaultPageSettings.Margins = New Margins(100, 10, 100, bottom)
'------------------------------------------------
GcMultiRow1.Document = temp
' 印刷の処理
temp.Print()
[C#]
// 印刷の設定
PrintDocument temp = new PrintDocument();
// ------------------------------------------------
// 最後の行が印刷されない現象の回避方法
int bottom;
// 用紙が横向きの場合
temp.DefaultPageSettings.Landscape = true;
bottom = (int)temp.DefaultPageSettings.PaperSize.Width - (int)temp.DefaultPageSettings.PrintableArea.Width + 1;
//// 用紙が縦向きの場合
//temp.DefaultPageSettings.Landscape = false;
//bottom = (int)temp.DefaultPageSettings.PaperSize.Height - (int)temp.DefaultPageSettings.PrintableArea.Height + 1;
temp.DefaultPageSettings.Margins = new Margins(100, 10, 100, bottom);
// ------------------------------------------------
gcMultiRow1.Document = temp;
// 印刷の処理
temp.Print();
最新のService Packのダウンロードはこちら 。
または、DefaultPageSettings.Marginsプロパティのbottomに対して、ページの用紙サイズと印刷可能領域から計算した値を設定することで回避することが可能です。
なお、設定する値は用紙の向きによって、以下のように変更する必要があります。
- 用紙が横向き(Landscape = True)の場合
DefaultPageSettings.PaperSize.Width - DefaultPageSettings.PrintableArea.Width < bottomの値
- 用紙が縦向き(Landscape = False)の場合
DefaultPageSettings.PaperSize.Height - DefaultPageSettings.PrintableArea.Height < bottomの値
[Visual Basic]
' 印刷の設定
Dim temp As New PrintDocument
'------------------------------------------------
'最後の行が印刷されない現象の回避方法
Dim bottom As Integer
'用紙が横向きの場合
temp.DefaultPageSettings.Landscape = True
bottom = temp.DefaultPageSettings.PaperSize.Width - temp.DefaultPageSettings.PrintableArea.Width + 1
''用紙が縦向きの場合
'temp.DefaultPageSettings.Landscape = False
'bottom = temp.DefaultPageSettings.PaperSize.Height - temp.DefaultPageSettings.PrintableArea.Height + 1
temp.DefaultPageSettings.Margins = New Margins(100, 10, 100, bottom)
'------------------------------------------------
GcMultiRow1.Document = temp
' 印刷の処理
temp.Print()
[C#]
// 印刷の設定
PrintDocument temp = new PrintDocument();
// ------------------------------------------------
// 最後の行が印刷されない現象の回避方法
int bottom;
// 用紙が横向きの場合
temp.DefaultPageSettings.Landscape = true;
bottom = (int)temp.DefaultPageSettings.PaperSize.Width - (int)temp.DefaultPageSettings.PrintableArea.Width + 1;
//// 用紙が縦向きの場合
//temp.DefaultPageSettings.Landscape = false;
//bottom = (int)temp.DefaultPageSettings.PaperSize.Height - (int)temp.DefaultPageSettings.PrintableArea.Height + 1;
temp.DefaultPageSettings.Margins = new Margins(100, 10, 100, bottom);
// ------------------------------------------------
gcMultiRow1.Document = temp;
// 印刷の処理
temp.Print();
キーワード
MLTR07965