作成日: 2017/09/26 最終更新日: 2017/09/26
文書種別
使用方法
詳細
用紙サイズを明示的に設定していない場合、実行環境の「通常使うプリンタ(デフォルトプリンタ)」のデフォルトの用紙サイズで印刷が実行されます。
異なる用紙サイズに印刷したい場合、Printメソッドの引数で用紙サイズを設定します。
◎サンプルコード(VB)
◎サンプルコード(C#)
ただし、上記で印刷方向(Landscape)を変更できるのはC1PrintManagerクラスのPrintメソッドを使用したときのみです。
C1PrintManagerクラスではPrintOptions.AutoRotateプロパティを"False"にすることで用紙の自動回転を無効にできますが、他クラスのPrintメソッドには該当する機能が用意されていないため、引数に設定されたLandscapeプロパティは無視され、レポート自体の印刷方向で印刷されます。
異なる用紙サイズに印刷したい場合、Printメソッドの引数で用紙サイズを設定します。
◎サンプルコード(VB)
Dim ps As New System.Drawing.Printing.PrinterSettings
ps.PrinterName = "プリンタ名"
' プリンタがサポートしている用紙サイズを取得
For Each psize As System.Drawing.Printing.PaperSize In ps.PaperSizes
If psize.Kind = System.Drawing.Printing.PaperKind.A3 Then
ps.DefaultPageSettings.PaperSize = psize
ps.DefaultPageSettings.Landscape = True ' ※C1PrintManagerクラスのPrintメソッドでのみ有効
Exit For
End If
Next
' C1Reportクラス
C1Report1.Print(ps)
' C1PrintDocumentクラス
Dim c1doc As C1.C1Preview.C1PrintDocument = C1Report1.C1Document
c1doc.Print(ps)
' C1PrintManagerクラス
Dim pmng As New C1.C1Preview.C1PrintManager()
pmng.PrintOptions.PageScaling = C1.C1Preview.PageScalingEnum.None
pmng.PrintOptions.AutoRotate = False
pmng.Document = C1Report1
pmng.Print(ps)
ps.PrinterName = "プリンタ名"
' プリンタがサポートしている用紙サイズを取得
For Each psize As System.Drawing.Printing.PaperSize In ps.PaperSizes
If psize.Kind = System.Drawing.Printing.PaperKind.A3 Then
ps.DefaultPageSettings.PaperSize = psize
ps.DefaultPageSettings.Landscape = True ' ※C1PrintManagerクラスのPrintメソッドでのみ有効
Exit For
End If
Next
' C1Reportクラス
C1Report1.Print(ps)
' C1PrintDocumentクラス
Dim c1doc As C1.C1Preview.C1PrintDocument = C1Report1.C1Document
c1doc.Print(ps)
' C1PrintManagerクラス
Dim pmng As New C1.C1Preview.C1PrintManager()
pmng.PrintOptions.PageScaling = C1.C1Preview.PageScalingEnum.None
pmng.PrintOptions.AutoRotate = False
pmng.Document = C1Report1
pmng.Print(ps)
◎サンプルコード(C#)
var ps = new System.Drawing.Printing.PrinterSettings();
ps.PrinterName = "プリンタ名";
// プリンタがサポートしている用紙サイズを取得
foreach (System.Drawing.Printing.PaperSize psize in ps.PaperSizes)
{
if (psize.Kind == System.Drawing.Printing.PaperKind.A3)
{
ps.DefaultPageSettings.PaperSize = psize;
ps.DefaultPageSettings.Landscape = true; // ※C1PrintManagerクラスのPrintメソッドでのみ有効
break;
}
}
// C1Reportクラス
c1Report1.Print(ps);
// C1PrintDocumentクラス
C1.C1Preview.C1PrintDocument c1doc = c1Report1.C1Document;
c1doc.Print(ps);
// C1PrintManagerクラス
var pmng = new C1.C1Preview.C1PrintManager();
pmng.PrintOptions.PageScaling = C1.C1Preview.PageScalingEnum.None;
pmng.PrintOptions.AutoRotate = false;
pmng.Document = c1Report1;
pmng.Print(ps);
ps.PrinterName = "プリンタ名";
// プリンタがサポートしている用紙サイズを取得
foreach (System.Drawing.Printing.PaperSize psize in ps.PaperSizes)
{
if (psize.Kind == System.Drawing.Printing.PaperKind.A3)
{
ps.DefaultPageSettings.PaperSize = psize;
ps.DefaultPageSettings.Landscape = true; // ※C1PrintManagerクラスのPrintメソッドでのみ有効
break;
}
}
// C1Reportクラス
c1Report1.Print(ps);
// C1PrintDocumentクラス
C1.C1Preview.C1PrintDocument c1doc = c1Report1.C1Document;
c1doc.Print(ps);
// C1PrintManagerクラス
var pmng = new C1.C1Preview.C1PrintManager();
pmng.PrintOptions.PageScaling = C1.C1Preview.PageScalingEnum.None;
pmng.PrintOptions.AutoRotate = false;
pmng.Document = c1Report1;
pmng.Print(ps);
ただし、上記で印刷方向(Landscape)を変更できるのはC1PrintManagerクラスのPrintメソッドを使用したときのみです。
C1PrintManagerクラスではPrintOptions.AutoRotateプロパティを"False"にすることで用紙の自動回転を無効にできますが、他クラスのPrintメソッドには該当する機能が用意されていないため、引数に設定されたLandscapeプロパティは無視され、レポート自体の印刷方向で印刷されます。
関連情報
旧文書番号
82373