Hello,
When I generate the report using .NET Engine (v 2022.4.5) the pdf is not ok, when I check with designer it is. I think that it doesnt take relation created in databand of subreport.
var report = new StiReport();
report.Load("e:\\MonthlyPreventive.mrt")
var dataSet = StiJsonToDataSetConverterV2.GetDataSetFromFile("C:\\newdata.json")
report.RegData("dataSet", dataSet);
report.Dictionary.DataSources.Clear();
report.Dictionary.Synchronize();
report.Dictionary.Connect();
report.Render(false);
report.ExportDocument(StiExportFormat.Pdf, "C:\\report.pdf")
I have attached files
mrt generated file different than designer view
mrt generated file different than designer view
- Attachments
-
- newdata.json
- (872.24 KiB) Downloaded 87 times
-
- MonthlyPreventive.mrt
- (2.95 MiB) Downloaded 92 times
-
- generatemrt.jpg (292.36 KiB) Viewed 866 times
-
- designer.jpg (168.5 KiB) Viewed 866 times
-
- Posts: 786
- Joined: Tue Sep 07, 2021 10:11 am
Re: mrt generated file different than designer view
Hello,
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
Re: mrt generated file different than designer view
Any news about this?
-
- Posts: 786
- Joined: Tue Sep 07, 2021 10:11 am
Re: mrt generated file different than designer view
Hello,
Please use the following code :
Thank you.
Please use the following code :
Code: Select all
var report = new StiReport();
report.Load("e:\\MonthlyPreventive.mrt")
var dataSet = StiJsonToDataSetConverterV2.GetDataSetFromFile("C:\\newdata.json")
report.RegData("dataSet", dataSet);
//report.Dictionary.DataSources.Clear();
report.Dictionary.Synchronize();
report.Dictionary.Connect();
report.Render(false);
report.ExportDocument(StiExportFormat.Pdf, "C:\\report.pdf")
Re: mrt generated file different than designer view
Dear support,
If this line is commented
report.Dictionary.DataSources.Clear();
the format is ok but the report is created using data stored in the template "MonthlyPreventive.mrt", but not with data saved in "newdata.json" which is the objective.
Could you please provide other solution?
Thank you
If this line is commented
report.Dictionary.DataSources.Clear();
the format is ok but the report is created using data stored in the template "MonthlyPreventive.mrt", but not with data saved in "newdata.json" which is the objective.
Could you please provide other solution?
Thank you
-
- Posts: 786
- Joined: Tue Sep 07, 2021 10:11 am
Re: mrt generated file different than designer view
Hello,
If you want to use new data from "newdata.json" you also need to create a new relation between two tabels,
which was created separately and used in the databand. Please check the attached images.
You can use the following code:
Thank you.
If you want to use new data from "newdata.json" you also need to create a new relation between two tabels,
which was created separately and used in the databand. Please check the attached images.
You can use the following code:
Code: Select all
var report = new StiReport();
report.Load("..\\Reports\\MonthlyPreventive.mrt");
var dataSet = StiJsonToDataSetConverterV2.GetDataSetFromFile("D:\\newdata.json");
report.Dictionary.DataSources.Clear();
report.RegData("dataSet", dataSet);
report.Dictionary.Synchronize();
var relation = new Stimulsoft.Report.Dictionary.StiDataRelation("Relation", "Name", "Name", report.Dictionary.DataSources["actSummary_PerActivity_OverviewPeriod"], report.Dictionary.DataSources["actSummary_PerActivity_ReportPeriod"], new string[] {
"ActivityId"}, new string[] {
"ActivityId"});
report.Dictionary.Relations.Add(relation);
//report.Dictionary.Connect();
report.Render(false);
report.ExportDocument(StiExportFormat.Pdf, "D:\\report.pdf");
- Attachments
-
- Designer_m9uFeY7t51.png (44.96 KiB) Viewed 807 times