所创建的报表既可以在Windows窗体应用程序中使用,也可以在Asp.Net应用程序中使用。可导出多种数据格式,比如:PDF,XML,HTML,Word,Excel,RTF格式,文本文件,CSV,BMP和JPEG格式,GIF,PNG,TIFF格式等。
要保存报告:
StiReport report = new StiReport();
report.Save("report.mrt");
加载报告:
StiReport report = new StiReport();
report.Load("report.mrt");
要加载DataSet XSD模式,可以使用ImportXMLSchema方法:
StiReport report = new StiReport();
DataSet dataSet = new DataSet("Test");
dataSet.ReadXmlSchema("dataset.xsd");
report.Dictionary.ImportXMLSchema(dataSet);
渲染报告并在预览窗口中显示渲染的报告:
StiReport report = new StiReport();
report.Load("report.mrt");
report.Show();
要访问变量,可以使用以下代码:
StiReport report = new StiReport();
report.Load("Variables.mrt");
report.Compile();
// Set Variable
report["VariableName"] = "Value";
// Get Variable
object value = report["VariableName"];
有必要在数据存储中注册数据以将其附加到报表。您可以这样进行:
DataSet dataSet1 = new DataSet();
dataSet1.ReadXmlSchema("Demo.xsd");
dataSet1.ReadXml("Demo.xml");
StiReport report = new StiReport();
report.RegData(dataSet1);
像这样做:
StiReport report = new StiReport();
report.Design();
要保存呈现的报告:
// Rendering report
StiReport report = new StiReport();
report.Load("report.mrt");
report.Render();
// Saving report
report.SaveDocument("document.mdc");
加载先前保存的渲染报告:
StiReport report = new StiReport();
report.LoadDocument("document.mdc");
对于报告的初始负载:
StiReport report = new StiReport();
report.LoadDocument("document.mdc");
现在打印报告:
report.Print();
.NET报表生成器Stimulsoft Reports.Net 常问问题解答
原文:https://blog.51cto.com/15078157/2623666