Loading reports from Stimulsoft Reports.Server
Posted: Wed Mar 23, 2016 9:29 am
Hello.
We're evaluating your products. We have configured a Stimulsoft Reports.Server in one machine so our customers can edit reports online. At the same time, we would like to load those reports (hosted in the server) using an application in .NET (WPF) as PDF.
We've looked along all your website, but the only code that we found was the one below. The problem is the classes it uses aren't found in any of the assemblies that come in your .NET / WPF trials.
Please, tell me how to connect and retrieve reports as PDF from your Reports.Server instance.
Thank you.
// Connect to Stimulsoft Report Server on port 40010
var connection = new StiServerConnection("http://localhost:40010/");
// User Name and Password from actions
connection.Users.Login("username", "password");
// Load Data in ByteArray
var bytes = File.ReadAllBytes("Data.xml");
// Get Item from Access Key
var dataItem = connection.Items.Get("94ebe81e880843fb899eee393397f092") as StiFileItem;
// Create Item if it does not exist
if (dataItem == null) dataItem = connection.Items.Root.NewFile("data.xml", StiFileType.Xml);
// Upload Data to Item
fileItem.UploadFromArray(bytes);
// Get PDF Item from Access Key
var pdfItem = connection.Items.Get("b17ce23f44ee411793440bceb61d4ba6") as StiFileItem;
// Create Item if it does not exist
if (pdfItem == null) pdfItem = connection.Items.Root.NewFile("report.pdf", StiFileType.Pdf);
fileItemPdf.Save();
// Get Report from Access key
var reportItem = connection.Items.Get("4cf1d78e5773470880b0145f895c7f00") as StiReportTemplateItem;
// Create Item if it does not exist
if (reportItem == null) reportItem = connection.Items.Root.NewFile("report", StiFileType.ReportSnapshot);
// Compile Report to PDF Item
reportItem.Run(pdfItem);
// Download PDF to ByteArray
var result = fileItemPdf.DownloadToArray();
// Logout User
connection.Users.Logout();
We're evaluating your products. We have configured a Stimulsoft Reports.Server in one machine so our customers can edit reports online. At the same time, we would like to load those reports (hosted in the server) using an application in .NET (WPF) as PDF.
We've looked along all your website, but the only code that we found was the one below. The problem is the classes it uses aren't found in any of the assemblies that come in your .NET / WPF trials.
Please, tell me how to connect and retrieve reports as PDF from your Reports.Server instance.
Thank you.
// Connect to Stimulsoft Report Server on port 40010
var connection = new StiServerConnection("http://localhost:40010/");
// User Name and Password from actions
connection.Users.Login("username", "password");
// Load Data in ByteArray
var bytes = File.ReadAllBytes("Data.xml");
// Get Item from Access Key
var dataItem = connection.Items.Get("94ebe81e880843fb899eee393397f092") as StiFileItem;
// Create Item if it does not exist
if (dataItem == null) dataItem = connection.Items.Root.NewFile("data.xml", StiFileType.Xml);
// Upload Data to Item
fileItem.UploadFromArray(bytes);
// Get PDF Item from Access Key
var pdfItem = connection.Items.Get("b17ce23f44ee411793440bceb61d4ba6") as StiFileItem;
// Create Item if it does not exist
if (pdfItem == null) pdfItem = connection.Items.Root.NewFile("report.pdf", StiFileType.Pdf);
fileItemPdf.Save();
// Get Report from Access key
var reportItem = connection.Items.Get("4cf1d78e5773470880b0145f895c7f00") as StiReportTemplateItem;
// Create Item if it does not exist
if (reportItem == null) reportItem = connection.Items.Root.NewFile("report", StiFileType.ReportSnapshot);
// Compile Report to PDF Item
reportItem.Run(pdfItem);
// Download PDF to ByteArray
var result = fileItemPdf.DownloadToArray();
// Logout User
connection.Users.Logout();