作成日: 2024/04/10 最終更新日: 2024/10/18
文書種別
技術情報
詳細
ActiveReports for .NET 18.0J では、System.Drawingへの依存関係を削除したため、多数の名前空間が変更されています。詳細は製品ヘルプの「変更点」をご確認ください。
名前空間の変更はファイルコンバータの処理で更新されない場合があります。
該当する記述でエラーが発生する場合は、手動で変更してください。
- System.Drawing.Printing ⇒ GrapeCity.ActiveReports.Printing
- System.Drawing.Image ⇒ GrapeCity.ActiveReports.Document.Drawing.Image
- GrapeCity.ActiveReports.Drawing ⇒ GrapeCity.ActiveReports.Document.Section
System.Drawing.Printing ⇒ GrapeCity.ActiveReports.Printing
旧バージョンの印刷機能では .NET標準のSystem.Drawing.Printing名前空間を使用していましたが、バージョン18.0Jでは製品独自のGrapeCity.ActiveReports.Printing名前空間を使用します。
ActiveReports以外の処理でSystem.Drawing.Printingが使用されている可能性があるため、この変更はファイルコンバータの更新対象になっていません。
新しい記述例は以下のナレッジをご確認ください。
※制限事項
18.0JのSectionDocument.PrinterはSystem.Drawing.Printing.PrintDocumentを継承していません。
そのため、セクションレポートの描画結果をPrintDocumentとして扱う処理は18.0Jでは実現できません。
具体的には以下のような処理がエラーになります。
var rpt = new SectionReport1(); rpt.Run(); var printDialog = new System.Windows.Forms.PrintDialog(); printDialog.Document = rpt.Document.Printer; if(printDialog.ShowDialog() == DialogResult.OK) { printDialog.Document.Print(); }
旧バージョンで上記のような処理を実行していた場合は、ActiveReportsのViewerコントロールやPrintメソッドを使用して印刷するように変更してください。
System.Drawing.Image ⇒ GrapeCity.ActiveReports.Document.Drawing.Image
PictureコントロールのImageプロパティは、System.Drawing名前空間のImageクラスからGrapeCity.ActiveReports.Document.Drawing名前空間のImageクラスに変更されました。
画像を動的に設定している場合、名前空間の変更が必要になります。
新しい記述例は以下のナレッジをご確認ください。
※制限事項
新しい名前空間のImageクラスは画像の読込のみをサポートしてます。
画像の操作や保存を行うメソッドは実装されていません。
それらの処理が必要となる場合は、一旦、System.Drawing.Imageに読み込んでから再設定してください。
private void detail_Format(object sender, EventArgs e) { // 画像のバイナリデータをSystem.Drawing.Imageに読み込む var image1 = System.Drawing.Image.FromStream(new MemoryStream(picture1.ImageBytes)); (image1のメソッドを呼び出す処理) // Pictureコントロールに再設定する var ms = new MemoryStream(); image1.Save(ms, System.Drawing.Imaging.ImageFormat.Png); picture1.ImageBytes = ms.ToArray(); }
GrapeCity.ActiveReports.Drawing ⇒ GrapeCity.ActiveReports.Document.Section
以下の列挙型はバージョン14.0Jでのみ異なる名前空間に属していました。
バージョン14.0Jから移行する場合は、手動での変更が必要です。
- TextAlignment
- TextJustify
- VerticalTextAlignment
- WrapMode
◆サンプルコード
var rpt = new SectionReport1();
rpt.Run();
// 14.0J rpt.Document.Pages[0].TextAlignment = GrapeCity.ActiveReports.Drawing.TextAlignment.Center; // 18.0J rpt.Document.Pages[0].TextAlignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Center;