.NET API Printing
Description
Intention is to show the following possibilities:
i.Generating report of one object reference
ii.Generating reports of multiple object references
iii.Generating report of “General” report type
iv.Transferring parameter values to report
Procedure
i.To generate report (e.g. LocationDetail) of one object reference
Element location = . . . ; // get the element to print List<int> ids = api.Reports.FindElementIdsByName("LocationDetail"); if (ids.Count == 1) { int reportId = ids[0]; api.Reports.SaveReportAsPdf(reportId, location, "C:\\temp"); } |
ii.To generate report (e.g. LocationDetail) of multiple object references
List<Element> locations = . . . ; // get the element to print List<int> ids = api.Reports.FindElementIdsByName("LocationDetail"); if (ids.Count == 1) { int reportId = ids[0]; api.Reports.SaveReportAsPdf(reportId, locations, "C:\\temp"); } |
iii.To generate report of “General” report type
List<int> ids = api.Reports.FindElementIdsByName("CommonReport1"); if (ids.Count == 1) { int reportId = ids[0]; api.Reports.SaveReportAsPdf(reportId, "C:\\temp"); } |
iv.To generate report (e.g. LocationDetail) of one object reference and to transfer parameters to report
Element location = . . . ; // get the element to print List<int> ids = api.Reports.FindElementIdsByName("LocationDetail"); if (ids.Count == 1) { int reportId = ids[0]; Dictionary<string, object> parameter2value = new Dictionary<string, object>(); parameter2value["A"] = 1; api.Reports.SaveReportAsPdf( reportId, location, "C:\\temp", true, parameter2value); } |