This sample project demonstrates how to connect to data from the code. First of all, use
ShowWithWpf()
method to show the report:
private void ShowReport(DataSet dataSet)
{
var report = new StiReport();
report.Load(@"Reports\TwoSimpleLists.mrt");
report.Dictionary.Databases.Clear();
report.RegData("Demo", dataSet);
report.ShowWithWpf();
}
...
Then, connect to data:
...
private void ButtonXML_Click(object sender, RoutedEventArgs e)
{
var dataSet = new DataSet();
dataSet.ReadXmlSchema(@"Data\Demo.xsd");
dataSet.ReadXml(@"Data\Demo.xml");
ShowReport(dataSet);
}
private void ButtonJSON_Click(object sender, RoutedEventArgs e)
{
var dataSet = StiJsonToDataSetConverterV2.GetDataSetFromFile(@"Data\Demo.json");
ShowReport(dataSet);
}
На скриншоте ниже Вы можете увидеть результат выполнения данного кода: