Hello,
I am getting the following error when trying to print a report from my website:
But when in my local machine, it displays correctly. The database is the same, no changes between then.
Regards,
Alexandre
My report viewer was working without issue for some time until caching with DistributedSqlServerCache was implemented. It is configured as follows.
services.TryAddSingleton<IReportServiceConfiguration>(configuration =>
new ReportServiceConfiguration {
HostAppId = "Reports",
ReportingEngineConfiguration = new ConfigurationBuilder().AddJsonFile(Path.Combine(configuration.GetService<IWebHostEnvironment>().ContentRootPath, "appsettings.json"), true).Build(),
ReportSourceResolver = new UriReportSourceResolver(Path.Combine(configuration.GetService<IWebHostEnvironment>().ContentRootPath, "App_Data")).AddFallbackResolver(new TypeReportSourceResolver()),
Storage = new MsSqlServerStorage("connection-string")
}
);
public class ReportsController : ReportsControllerBase {
public ReportsController(IReportServiceConfiguration reportServiceConfiguration) : base(reportServiceConfiguration) {
reportServiceConfiguration.Storage.AcquireLock(string.Format("Lock-{0}", new Random().Next()));
}
}
Note that the AcquireLock() method mentioned above was added in response to this comment from Telerik:
The interface also exposes a method called AcquireLock which is used from the service to enforce serialized access to all stored resources from each thread of the application and between the instances of the application in case of multi-instance environment (i.e., Web Farm)
Which I suspect may apply here, but unfortunately I can only hazard guess in light of its appalling lack of documentation.
A typical error message reported by the viewer is:
Error creating report document (Report = 'XXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Format = 'HTML5'). An error has occurred. Object reference not set to an instance of an object.
function registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId) {
throwIfNotInitialized();
throwIfNoReportInstance();
return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function(xhrErrorData) {
handleRequestError(xhrErrorData, utils.stringFormat(sr.errorCreatingReportDocument, [ utils.escapeHtml(report), utils.escapeHtml(format) ]));
});
}
to this:
function registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId) {
throwIfNotInitialized();
throwIfNoReportInstance();
return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function () {
console.log("Failed to create report document. A retry has been attempted.");
return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function (xhrErrorData) {
handleRequestError(xhrErrorData, utils.stringFormat(sr.errorCreatingReportDocument, [utils.escapeHtml(report), utils.escapeHtml(format)]));
});
});
}
Hello,
I have a report wich has one parameter. When I try to pass a new value in javascript it does not accept it, and uses the sample parameter that is inside the report.
Parameter in the Report:
Passing Parameter in Javascript:
Where 'noFichaVistoria' is the variable containing the new parameter value.
Has anyone faced this before?
Alexandre
Hi i'm davide, in these days i'm working for a project that requires telerik on windows form c# desktop application. So i'm trying to figure out what i need to do it but i don't find pretty much anything online, i can't find a solution please help me.
My little exercise consist in asking a year of school (1 to 5) to print only the ones students in that year, cvyear is a int from 0 to 5, I'M ITALIAN SO 1) ANNO = YEAR, classes is a type class, stu is a list of student. CODE:
string year = cvyear.ToString();
This is my scenerio.
i have report in xml stored in database, report has subreports as uri
<UriReportSource Uri="sub_report1.trdx">
i have rest api service that consume xml , render it as pdf and returns it as byte[].
And everything works fine but my custom resolver dosnt fire.
It seems to be that when I DO NOT use telerik_ReportViewer, resolve event doesnt invoke, am i right? My rest api service does not even inherits from Telerik ReportsControllerBase
my desire is when i call renderReport customResolver is invoked, i download xml for subreport (based on uri trdx) and i put them together with main report and return "As complete"
Can i configure it to achieve what i want ?
my server side code
//xDoc represents report in xml
using var tr = new StringReader(xDoc.Root.ToString());
var xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
var report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(tr);
ReportProcessor reportProcessor = new ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = report;
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
return result.DocumentBytes;
On all of our reports we have a `CustomerId` and `UserId` that are part of our JWT token, this is what our reports controller looks like
[Route("api/[controller]")]
[Authorize]
[ApiController]
public class ReportsController : ReportsControllerBase
{
public ReportsController(IReportServiceConfiguration reportServiceConfiguration)
: base(reportServiceConfiguration)
{
}
}
So how can we set the CustomerId and UserId on the server side? We call our client side code like this:
$("#reportViewer1")
.telerik_ReportViewer({
serviceUrl: "/api/reports/",
authenticationToken: token,
viewMode: "PRINT_PREVIEW",
reportSource: {
report: fileName + ".trdp",
parameters: postData
},
//sendEmail: { enabled: true },
});
[ENGLISH]
Greetings, I'm a newbie, I'm testing telerik while learning c# with visual studio and WinForms. The issue is that I have made a report that is later displayed in a reportviewer, the problem is that clicking on the print icon of the reportviewer adds a blank space to the right side of the sheet to be printed, it is worth mentioning that the sheet is set to A4 (margins 0.5mm, + width 20cm = 21cm =>A4).
Image 01 - The report design is seen,
Screenshot 02 - The reportviewer added in the windowsform is seen,
Image 03 - It is seen when the report is loaded, so far so good.
Image 04 - It is seen when I click on the print or preview icon (any of the two) and the blank space on the sheet is displayed. Even when printing a physical document, the additional space is shown.
Image 05 - This image shows the code that I use to pass data to the reportviewer and the table.
By code I have not added any configuration, only the filling of data to the table.
What am I doing wrong, do I need to configure any additional parameters? Please help.
[ESPAÑOL]
Saludos, soy novato, estoy probando telerik mientras aprendo c# con visual studio y WinForms. El asunto es que tengo realizado un informe que posteriormente se muestra en un reportviewer, el problema es que al hacer clic en el icono de imprimir del reportviewer se agrega un espacio en blanco al lado derecho de la hoja a imprimir, cabe mencionar que la hoja está configurada en A4 (margins 0.5mm, + width 20cm = 21cm =>A4).Hello,
I had a report in my application that was working fine, but suddendly it started displaying the following message:
Unable to get report parameters. An error has occurred. Cannot read a document with the specified schema: http://schemas.telerik.com/reporting/2023/1.0. You might be using an older version of the product.
Does anyone has ever seen that?
Regards,
Alexandre
Hi,
I use the telerik reporting version: 15.2.21.1125 .NET Core 6 MVC.
The service is working correctly, but there are errors in the logs.
And sometimes when I click to generate a report, I get this error.
RequestPath: /TelerikReporting/Report/clients/f06d6c18a51/instances/d88f958a6a9/documents
Exception.StackTrace:
{
"ClassName": "System.NullReferenceException",
"Message": "Object reference not set to an instance of an object.",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"HResult": -2147467261,
"HelpURL": null,
"Depth": 0,
"Source": "Telerik.Reporting",
"StackTraceString": " at Telerik.Reporting.Services.Engine.ReportEngine.CreateDocumentCore(ReportInstance instance, Refresh refresh, String format, Dictionary`2 deviceInfo, ReportDocumentState rds, String clientID)\n at Telerik.Reporting.Services.Engine.ReportEngine.CreateDocument(String clientID, String instanceID, String format, Dictionary`2 deviceInfo, Boolean useCache, String baseDocumentID, String actionID)\n at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.CreateDocument(String clientID, String instanceID, CreateDocumentArgs args)\n at lambda_method473(Closure , Object , Object[] )\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location ---\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
}
I would be grateful for your assistance.
Hi,
We already have a licence for the 2023 Telerik Reporting licence. However, since our application uses R3 2017 Telerik Reporting, I wanted to install that instead. However, it keeps on installing the 2023 version. Could you please tell me where the R3 2017 version is and the link to download this particular version.