在你的程序中,你可以使用FastReport.Net 報表設計器。要做到這一點,你需要使用報表對象設計方法:
report1 = new Report();
report1.Load("report1.frx");
report1.Design();
設計方法被重載:
方法 | 描述 |
---|---|
bool Design() | 顯示設計器 |
bool Design( bool modal) |
顯示設計器,modal參數決定是否需要形式上展示設計器 |
bool Design( Form mdiParent) |
顯示設計器,mdiParent參數定義主要的MDI窗口 |
導出報表
設計好的報表可以被導出為FastReport報表所支持的其中一種格式。你可以導出為下列格式中的一種:
- HTML
- RTF
- Excel XML (Excel 2003+)
- Excel 2007
- CSV
- TXT
- OpenOffice Calc
- Pictures (Bmp, Png, Jpeg, Gif, Tiff, Metafile)
通過導出過濾器來導出,步驟如下:
- 通過Prepare方法准備一個報表
- 創建一個導出過濾器實例,並設置其屬性
- 調用報表對象的導出方法
下面的例子導出了一個HTML格式編寫的報表:
// prepare a report
report1.Prepare();
// create an instance of HTML export filter
FastReport.Export.Html.HTMLExport export = new FastReport.Export.Html.HTMLExport();
// show the export options dialog and do the export
if (export.ShowDialog())
report1.Export(export, "result.html");