作者:pengxl 来源:慧都控件网 浏览:Loading... 日期:2012-09-24
下面是格式列表,支持本地的Stimulsoft报表,没有必要使用第三方或COM组件就可直接进行转换。
支持导出设置
Stimulsoft Reports使用的ExportDocument功能的StiReport对象支持导出文件到磁盘上。报表框架也有针对于直接导出报表到http响应的StiReportResponse类,用户可以在web应用程序上直接下载报表,当你导出报表到http响应时,会提供下面列出的导出选项。
1) openDialog标志:
如果这个标志设置为true,会强迫用户在打开之前进行下载,如果标志设置为false,它将允许浏览器打开应用程序显示报表。例如:如果输出格式是PDF和显示对话框标志设为false,如果它被安装在客户端计算机上的话,浏览器会打开Adobe Reader®,如果显示对话框标志被设置为true,浏览器会提示用户下载报表,即使Adobe Reader®查看器是安装到客户端计算机上。
例子:
StiReport oSR = stiBooksReport.GetReport(); //set the StiReport report object
StiReportResponse.ResponseAsPdf(this, oSR, false); // Export report to pdf and force user to download the file
StiReportResponse.ResponseAsPdf(this, oSR); // Export
在下面的屏幕截图里,openDialog设置为false,所以在嵌入式阅读器中会打开PDF。
在下面的屏幕截图中,openDialog被设置成了true,所以要求打开使用,在浏览器上保存或者是取消。
2) StiPagesRanges
如果程序员想要定义要被导出的报表页面,他们可以选择传递一个对象的StiPagesRange类作为导出功能的参数,stiPagesRange程序员可以导出一个页面或者是给出将要导出的报表页面范围。
例子:
Export page 1
StiReport oSR = stiBooksReport.GetReport(); //set the StiReport report object
StiPagesRange oSPR = new StiPagesRange(1); // Export page 1
StiReportResponse.ResponseAsPdf(this, oSR, false, oSPR); // Export report to pdf and open the file in browser
// Export pages 1 to 10
StiReport oSR = stiBooksReport.GetReport(); //set the StiReport report object
StiPagesRange oSPR = new StiPagesRange("1-10"); // Export pages 1 to 10
StiReportResponse.ResponseAsPdf(this, oSR, false, oSPR); // Export report to pdf and open the file in browser
3) StiPdfExportSettings
这个参数可以让程序员进行优先导出设置,如下所示:
a)压缩标志:启用/禁用压缩的PDF
b)创造者字符串:设置创造者名称
c)图像质量:设置图像质量
d)图像的分辨率:设置图像分辨率
e)允许嵌入字体:允许在PDF中嵌入字体
f)关键字:关键词
g)密码:Pdf安全密码
h)数字证书:启用/禁用本地数字签名和证书
i)页面范围的:被导出的页面范围
4) StiExcelExportSettings
这个参数主要是用在报表导出到Excel时,下面列出得高级属性都可以进行设置。
a)ExportDataOnly:只导出数据,没有格式和图像。
b)ExportEachPageToSheet:导出每个报告页面到一个新的excel工作表
c)ExportObjectFormatting:导出格式化文本、图片和其他对象
d)ExportPageBreaks:导出换页打印的表单
e) ImageQuality:设置图像质量
f)ImageResolution:设置图像分辨率
g)PageRange:设置被导出页面范围
h)UseOnePageHeaderAndFooter:对整个表只使用一个页眉和页脚
在下面的屏幕截图中,导出数据被设置成false
导出数据被设置成true
添加报表到你的网页
添加一个新的连接到报告
添加表和页面标题到报告
在网页中添加报表
页面加载事件
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (stiRepViewerBooks.IsImageRequest)
nbsp;return; // ignore the page request if images are beign loaded for report viewer
if (!IsPostBack)
{
stiRepViewerBooks.Report = stiBooksReport.GetReport(); //set the StiReport report object when page loads for the first time
}
}
}
点击报表导出按钮导出报表
设置你每个导出按钮的事件处理程序,以便btnExport_Click调用StiReportResponse报表导出功能。
protected void btnExport_Click(object sender, EventArgs e)
{
StiReport oSR = stiBooksReport.GetReport(); //set the StiReport report object
oSR.Render(false);
if (sender == btnExportPdfShowDialogIsfalse)
StiReportResponse.ResponseAsPdf(this, oSR, false); // Export report as PDF with showDialog false
if (sender == btnExportPdf)
StiReportResponse.ResponseAsPdf(this, oSR); // Export report as PDF with showDialog true
if (sender == btnExportWord)
StiReportResponse.ResponseAsRtf(this, oSR); // Export report as a Word document
if (sender == btnExportExcel)
StiReportResponse.ResponseAsXls(this, oSR); // Export report as an Excel Sheet
}
Tag标签:.NET报表 Stimulsoft报表
上一篇: Stimulsoft Reports报表设计器详解
下一篇: 体验Stimulsoft报表检测器