I'm looking for example code to call/render report stored at Report Server from Progress 4GL language (Progress v.11.5, AIX box) and save it somewhere as .PDF file.
Hope what I want is possible.
Thanks.
1 Answer, 1 is accepted
0
Neli
Telerik team
answered on 20 Dec 2019, 11:42 AM
Hello Dariusz,
You can utilize the RS web API to request and get the reports from any environment. For further information, visit the following articles:
conststring REPORT_NAME = "ExampleReport1";
staticvoidMain()
{
ExecuteSampleScenario();
}
publicstaticvoidExecuteSampleScenario()
{
var settings = new Settings()
{
BaseAddress = "http://reportserver:83"
};
using (var client = new ReportServerClient(settings))
{
client.Login("admin", "111111");
var documentBytes = ExportDocument(client);
File.WriteAllBytes($@"C:\temp\{REPORT_NAME}.pdf", documentBytes);
System.Diagnostics.Process.Start($@"C:\temp\{REPORT_NAME}.pdf");
}
}
///<summary>/// Creates a single-format document and gets its bytes///</summary>///<param name="client"></param>///<returns></returns>staticbyte[] ExportDocument(ReportServerClient client)
{
var existingReport = client.GetReportInfos().Single(r => r.Name == REPORT_NAME);
var model = new CreateDocumentData
{
DeviceInfo = new Dictionary<string, object>(),
Format = "PDF",
ParameterValues = new Dictionary<string, object>(),
ReportId = existingReport.Id,
};
var documentId = client.CreateDocument(model);
return client.GetDocument(documentId);
}
}
Regards,
Neli
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items