原創(chuàng)|使用教程|編輯:鄭恭琳|2015-12-15 10:23:03.000|閱讀 2024 次
概述:本片文章主要介紹Stimulsoft Reports.Net開發(fā)者在輸出報表時遇到的常見問題及解決方案。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
< Stimulsoft Reports.Net v2015.3最新版本下載>
舉個例子,將報表輸出為PDF:
C#
StiReport report = new StiReport(); report.Load("report.mrt"); report.Render(); report.ExportDocument(StiExportFormat.Pdf, "document.pdf");
VB
Dim Report As StiReport = New StiReport() Report.Load("report.mrt") Report.Render() Report.ExportDocument(StiPdfExportFormat.Pdf, "document.pdf")
按照下面的方法在不使用對話框的情況下就可以輸出報表:
C#
StiReport report = new StiReport(); report.Load("report.mrt"); report.Render(); //Variant 1 StiPdfExportService pdfExport = new StiPdfExportService(); pdfExport.ExportPdf(report, "document.pdf"); //Variant 2 report.ExportDocument(StiExportFormat.Pdf, "document.pdf");
VB
Dim Report As StiReport = New StiReport() Report.Load("report.mrt") Report.Render() 'Variant 1 Dim PdfExport As StiPdfExportService = New StiPdfExportService() PdfExport.ExportPdf(Report, "document.pdf") 'Variant 2 report.ExportDocument(StiExportFormat.Pdf, "document.pdf")
在這個例子中,報表被輸出為PDF格式。你也可以使用下面的類將報表輸出為其它可用的格式:
你需要禁用所有不需要的報表輸出組件,同樣你也得使用Configurator.exe應(yīng)用程序禁用服務(wù)。
StiConfig.Load(); StiServiceContainer services = StiConfig.Services.GetServices(typeof(StiExportService)); foreach (StiService service in services) { if (service is StiBmpExportService)service.ServiceEnabled = false; if (service is StiCsvExportService)service.ServiceEnabled = false; if (service is StiEmfExportService)service.ServiceEnabled = false; if (service is StiGifExportService)service.ServiceEnabled = false; if (service is StiHtmlExportService)service.ServiceEnabled = false; if (service is StiJpegExportService)service.ServiceEnabled = false; if (service is StiPdfExportService)service.ServiceEnabled = false; if (service is StiRtfExportService)service.ServiceEnabled = false; if (service is StiTiffExportService)service.ServiceEnabled = false; if (service is StiTxtExportService)service.ServiceEnabled = false; if (service is StiXmlExportService)service.ServiceEnabled = false; } StiConfig.Save();
使用StiPage的GetThumbnail方法:
C#
Bitmap bmp = page.GetThumbnail(200, 300);
VB
Dim Bmp As Bitmap = Page.GetThumbnail(200, 300)
導(dǎo)出為HTML可以在兩種模式下工作:Table和Span。在Table模式中Stimulsoft Reports.Net生成一張大表,并將組件從頁面寫入到表行中。但在這種模式下頁面上的組件將不被交叉。在Span模式中報表引擎為每個組件生成橫跨對象。在這種情況下組件就會在頁面上交叉。
ExcelValue屬性是用于將數(shù)值輸出為Excel。默認情況下StiText組件被輸出為Excel的文本格式。
StiText組件的ExcelValue屬性的表達式將被輸出到Excel單元格,并且格式為數(shù)字。
購買最新正版授權(quán)!""
慧都年終盛典火爆開啟,一年僅一次的最強促銷,破冰鉅惠不容錯過!!優(yōu)惠詳情點擊查看>>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn