Stimulsoft Reports.Net FAQ
 
 
1. How to save/load a report?
2. How to load DataSet XSD schema?
3. How to render a report?
4. How to access to the variables?
5. How to attach data to a report?
6. How to run a report designer?
7. How to save/load a rendered report?
8. How to print a report immediately without preview?
1. How to save/load a report? 

To save a report:

C#

StiReport report = new StiReport();
report.Save("report.mrt");

VB

Dim Report As StiReport = New StiReport()
Report.Save("report.mrt")

To load a report:

C#

StiReport report = new StiReport();
report.Load("report.mrt");

VB

Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")


Back to top
2. How to load DataSet XSD schema? 

To load DataSet XSD schema you may use ImportXMLSchema method:

C#

StiReport report = new StiReport();
DataSet dataSet = new DataSet("Test");
dataSet.ReadXmlSchema("dataset.xsd");
report.Dictionary.ImportXMLSchema(dataSet);

VB

Dim Report As StiReport = New StiReport()
Dim Data As DataSet = New DataSet("Test")
Data.ReadXmlSchema("dataset.xsd")
Report.Dictionary.ImportXMLSchema(Data)


Back to top
3. How to render a report? 

To render a report and to show a rendered report in the preview window:

C#

StiReport report = new StiReport();
report.Load("report.mrt");
report.Show();

VB

Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
Report.Show()


Back to top
4. How to access to the variables? 

To access to the variables, you may use this code:

C#

StiReport report = new StiReport();
report.Load("Variables.mrt");
report.Compile();

//Set Variable
report["VariableName"] = "Value";

//Get Variable
object value = report["VariableName"];

VB

Dim Report As StiReport = New StiReport()
Report.Load("Variables.mrt")
Report.Compile()

'Set Variable
Report("VariableName") = " Value "

'Get Variable
Dim Value As Object = Report("VariableName")


Back to top
5. How to attach data to a report? 

It is necessary to register data in the Data Store to attach them to a report. You can do it this way:

C#

DataSet dataSet1 = new DataSet();
dataSet1.ReadXmlSchema("Demo.xsd");
dataSet1.ReadXml("Demo.xml");

StiReport report = new StiReport();
report.RegData(dataSet1);

VB

Dim Data As DataSet = New DataSet()
Data.ReadXmlSchema("Demo.xsd")
Data.ReadXml("Demo.xml")

Dim Report As StiReport = New StiReport()
Report.RegData(Data)


Back to top
6. How to run a report designer? 

Do it like this:

C#

StiReport report = new StiReport();
report.Design();

VB

Dim Report As StiReport = New StiReport()
Report.Design()


Back to top
7. How to save/load a rendered report? 

To save a rendered report:

C#

//Rendering report
StiReport report = new StiReport();
report.Load("report.mrt");
report.Render();
//Saving report
report.SaveDocument("document.mdc");

VB

'Rendering report
Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
Report.Render()
'Saving report
Report.SaveDocument("document.mdc")

To load previously saved rendered report:

C#

StiReport report = new StiReport();
report.LoadDocument("document.mdc");

VB

Dim Report As StiReport = New StiReport()
Report.LoadDocument("document.mdc")


Back to top
8. How to print a report immediately without preview? 

For a start load of a report:

C#

StiReport report = new StiReport();
report.LoadDocument("document.mdc");

VB

Dim Report As StiReport = New StiReport()
Report.LoadDocument("document.mdc")

And now print a report:

C#

report.Print();

VB

Report.Print()


Back to top
 
TwitterFacebookRSSLinked inYoutubeStimulsoft BlogViberWhatsAppSkype