I got my app working to Print a report from a button by following the example in the demo application(s). My page has a button, and in the code behind file I have the following code on the Click event:
Code: Select all
var folder = await Windows.Storage.KnownFolders.DocumentsLibrary.GetFolderAsync("FolderName");
var labelFile = await folder.GetFileAsync("MyReport.mrt");
// Create the report
StiReport report = new StiReport();
// Load the label file into the report
await report.LoadAsync(labelFile);
// Render the report
await report.RenderAsync();
// Print the report
await StiPrintReport.PrintAsync(report);
Code: Select all
this.printService.PrintLabel("LabelName");
Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))
Source: mscorlib
StackTrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Stimulsoft.Report.Viewer.RT.Print.StiPrintReport.<PrintAsync>d__0.MoveNext() in d:\Stimulsoft\Stimulsoft.Reports\Stimulsoft.Report.Viewer.RT\Print\StiPrintReport.cs:line 93
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at AX_Receiving.Services.LabelService.<PrintLabel>d__b.MoveNext() in d:\code\AX\AX_Receiving\AX_Receiving\Services\LabelService.cs:line 126
Any Ideas on this one?