SAP Knowledge Base Article - Public

1331213 - VS .NET アプリケーションで Crystal Reports 2008 からプリンタに印刷を実行するとカスタム用紙サイズの用紙の方向が無視される

Symptom

  • カスタム用紙サイズ (幅 8 インチ x 高さ 4 インチ) で作成されているレポートを、元の用紙方向で印刷することができません。
  • 用紙方向の設定が無視されます。
  • レポートが 4 インチ印刷されません。

Reproducing the Issue

  1. Windows OS で、"プリンタと FAX" を開きます。
  2. ファイル -> サーバーのプロパティを選択します。
  3. タブ用紙をクリックします。
  4. チェックボックス新しい用紙を作成するにチェックを入れます。
  5. 用紙名 (例: 8x4) を入力します。
  6. "用紙の説明 (単位)" で単位として "ヤードポンド法" を選択します。
  7. 用紙サイズの幅として 8 インチを入力します。
  8. 用紙サイズの高さとして 4 インチを入力します。
  9. フォームの保存をクリックします。
  10. 閉じるをクリックします。
  11. Crystal Reports 2008 を起動します。
  12. ファイル -> 新規作成 -> 空のレポートを選択します。
  13. ウィンドウ "データベース エキスパート" でキャンセルをクリックします。
  14. ファイル -> ページ設定を選択します。
  15. カスタム用紙サイズの印刷が可能なプリンタ (Microsoft XPS ドキュメントライタ) を選択します。
  16. 書式設定ページ サイズと用紙サイズを別個に設定するをチェックします。
  17. 作成するカスタム用紙サイズ (8x4) を選択します。
  18. "方向" で "縦" を選択します。
  19. OK をクリックします。
  20. レポートを作成します。
  21. ファイル -> 名前を付けて保存をクリックします。
  22. ファイル名を入力して、保存をクリックします。
  23. .NET アプリケーションからレポートを印刷します。
  • Crystal Reports 2008 SP1 FixPack 1.2 以降
  • Visual Studio 2005
  • Visual Studio 2008

印刷用のサンプル VB コード:

Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

myReport.Load("C:\custompapersize8x4.rpt")

Dim myPrintOptions As PrintOptions = myReport.PrintOptions

myPrintOptions.PrinterName = "Microsoft XPS Document Writer"

myPrintOptions.PaperOrientation = PaperOrientation.Portrait

' 119 is the value of custom paper size (8x4 inch) in the local Windows OS.

myPrintOptions.PaperSize = CType(119, PaperSize)

myReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True

myReport.PrintToPrinter(1, False, 1, 1)

Resolution

レポートを適切な用紙方向で印刷するためには、以下のステップおよび VB.NET コードを使用してください。

  1. 新規カスタム用紙サイズ (幅: 4 インチ x 高さ: 8 インチ) を登録します。
  2. カスタム用紙サイズ (幅: 4 インチ x 高さ: 8 インチ) の値を設定します。

Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

myReport.Load("C:\custompapersize8x4.rpt")

Dim myPrintOptions As PrintOptions = myReport.PrintOptions


myPrintOptions.PrinterName = "<プリンタ名>"

myPrintOptions.PaperOrientation = PaperOrientation.Portrait

' 120 is the value of custom paper size (4x8 inch) in the local Windows OS.

myPrintOptions.PaperSize = CType(120, PaperSize)

myReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True

myReport.PrintToPrinter(1, False, 1, 1)

Keywords

user defined paper size, devcap.exe, Microsoft XPS Document Writer, VS2005, VS2008, CR2008, ユーザ定義用紙サイズ, Microsoft XPS ドキュメントライタ, データベースエキスパート, 書式設定ページサイズと用紙サイズを別個に設定する , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V1