Telerik Forums
Reporting Forum
1 answer
39 views

I have a program that is installed in C:\Program Files (x86)\Qiagen\PGxUtils and I am using the code below to render reports by passing the full path of the report template to the function. This works fine when it is a single standalone report but when I try to use a report with subreports I get the following:

Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_PatientDemographics.trdp'., 
Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_Header.trdp'., 
Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_PrescribingInsights.trdp'., 
Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_RiskManagement.trdp'., 
Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_Medication.trdp'., 
Could not find file 'C:\Program Files (x86)\Qiagen\PGxUtils\SubFinalReportV1_TestResult.trdp'.

 

Reading the online documentation this seems to be by design but I need to know how to work around it in order to use subreports.

using Telerik.Reporting;
using System.Text.Json.Nodes;
using System.Text.Json;

namespace PdfReportBuilder
{
    public static class TelerikReportBuilder
    {
        public static ReportSource GetReportSource(string reportPath, JsonNode jsonNode)
        {
            var reportPackager = new ReportPackager();
            using (var sourceStream = System.IO.File.OpenRead(reportPath))
            {
                Report report = (Report)reportPackager.UnpackageDocument(sourceStream);
                var jsonDataSources = report.GetDataSources().OfType<JsonDataSource>();
                foreach (var jsonDataSource in jsonDataSources)
                {
                    jsonDataSource.Source = jsonNode.ToJsonString(new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
                    // This proves that Source can be assigned a json string, assigning a JsonNode doesn't work.
                    // JsonNode? tmp = JsonNode.Parse((jsonDataSource.Source as string)!);
                    // jsonDataSource.Source = tmp.ToJsonString(new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
                }
                return new InstanceReportSource
                {
                    ReportDocument = report
                };
            }
        }

        public static byte[] BuildReport(string reportPath, JsonNode jsonNode)
        {
            var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();

            // set any deviceInfo settings if necessary
            var deviceInfo = new System.Collections.Hashtable();

            ReportSource reportSource = GetReportSource(reportPath, jsonNode);

            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);

            if (!result.HasErrors)
            {
                return result.DocumentBytes;
            }
            else
            {
                throw new Exception(string.Join(", ", result.Errors.Select(ex => ex.Message)));
            }
        }

        public static byte[] BuildReport(string templatePath, JsonElement root)
        {
            JsonNode? jsonNode = JsonNode.Parse(root.GetRawText());
            if (jsonNode == null)
            {
                throw new ArgumentNullException(nameof(jsonNode), "Parsed JsonNode cannot be null.");
            }
            return BuildReport(templatePath, jsonNode);
        }
    }
}
Petar
Telerik team
 answered on 21 Mar 2025
0 answers
43 views
1 answer
29 views

On Windows I am able to set the background image of a textbox with the following code:


using (var surface = SkiaSharp.SKSurface.Create(new SkiaSharp.SKImageInfo(100, 100)))
{
    Telerik.Reporting.Processing.TextBox textbox;

    using (var image = surface.Snapshot())
    using (var data = image.Encode())
    {
        byte[] imageData = data.ToArray();
 
        using (var ms = new MemoryStream(imageData))
        {
            textbox.Style.BackgroundImage.ImageData = System.Drawing.Image.FromStream(ms);
        }
    }
}

Image.FromStream has the following error:

"CA1416: This call site is reachable on all platforms. 'Image.FromStream(Stream)' is only supported on: 'windows' 6.1 and later."

What is the Linux compatible version of Image.FromStream()?

Petar
Telerik team
 answered on 21 Mar 2025
0 answers
43 views

We are currently generating TRDX reports using the Telerik Report Designer tool, saving the XML output to a database. When a user runs a report, we retrieve the report XML, update the parameters, and then render the report using the Report Processor. However, we now need to export the report into multiple Excel tabs.

One potential solution is to use Report Book, which is stored in a TRBP file, but we're having trouble reading the contents of this file. Are there any alternative approaches we could take to achieve this functionality?

 
Rajesh
Top achievements
Rank 1
 asked on 20 Mar 2025
1 answer
30 views
We recently upgraded to latest version of Telerik Report Server. When using the standalone report designer if I turn off the autorun feature on the report and do a preview it works fine. But when I publish the report to our report server it doesn't seem to recognize this feature. Is there something we need to change on the server side to make this work? And is there a way to customize the wording displayed when report first opens?
0 answers
65 views

I have a standalone report that gets all the data from the table.  I added a bitmask filter to my SQL query, and I get the results I expect in SQL Studio.

SELECT 
    [Item],
    STRING_AGG([RuleNo], ', ') WITHIN GROUP (ORDER BY [RuleSort]) AS GroupedRuleNos
FROM [SFB_Annex].[dbo].[tblAnnex01]
LEFT JOIN [SFB_Annex].[dbo].[tblProducts] ON [tblAnnex01].[ProductID] = [tblProducts].[ProductID]
WHERE ([tblProducts].[QuadrantBitMask] & 32) != 0
GROUP BY [Item]
ORDER BY [Item];

When I try to add the bit mask as a filter, I keep getting an error "Cannot perform '<>' operation on System.Boolean and System.String."

Here is the filter I am trying to use:

                    Telerik.Reporting.Filter filter = new Telerik.Reporting.Filter();
                    filter.Expression = "=([tblProducts].[QuadrantBitMask] AND " + QuadrantBitMask.ToString() + ")";
                    filter.Operator = Telerik.Reporting.FilterOperator.NotEqual;
                    filter.Value = "!=0";
                    report.Filters.Add(filter);

How would I add the bitmasked value into the filter?

 

Ken
Top achievements
Rank 1
 asked on 15 Mar 2025
1 answer
39 views
➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
X [ERROR] Could not resolve "@progress/kendo-react-intl"

    node_modules/@progress/kendo-react-buttons/toolbar/tools/ToolbarOverflowSection.mjs:13:37:
      13 │ import { useLocalization as O } from "@progress/kendo-react-intl";
         ╵                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@progress/kendo-react-intl" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "@progress/kendo-react-intl"

    node_modules/@progress/kendo-react-buttons/toolbar/tools/ToolbarScrollButton.mjs:10:37:
      10 │ import { useLocalization as f } from "@progress/kendo-react-intl";
         ╵                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@progress/kendo-react-intl" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle.

C:\Users\anupa\Desktop\kendoReact\node_modules\esbuild\lib\main.js:1477
  let error = new Error(text);
              ^

Error: Build failed with 2 errors:
node_modules/@progress/kendo-react-buttons/toolbar/tools/ToolbarOverflowSection.mjs:13:37: ERROR: Could not resolve "@progress/kendo-react-intl"
node_modules/@progress/kendo-react-buttons/toolbar/tools/ToolbarScrollButton.mjs:10:37: ERROR: Could not resolve "@progress/kendo-react-intl"
    at failureErrorWithLog (C:\Users\anupa\Desktop\kendoReact\node_modules\esbuild\lib\main.js:1477:15)
    at C:\Users\anupa\Desktop\kendoReact\node_modules\esbuild\lib\main.js:946:25
    at C:\Users\anupa\Desktop\kendoReact\node_modules\esbuild\lib\main.js:1355:9
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v22.11.0
Plamen
Telerik team
 updated answer on 14 Mar 2025
1 answer
25 views

 

 

I'm getting below error while installing Telerik Reporting 2024 Q1 (18.0.24.130) Installation Error. I have downloaded the .msi file from Telerik site. Kindly Help.

 

 

Momchil
Telerik team
 answered on 13 Mar 2025
1 answer
41 views

I have been following the tutorials on creating PDFs of existing reports.  I have a function where I pass in the path name to the report (TRDP file).

Can you add filter or parameter to the report?

 

            ReportProcessor reportProcessor = new ReportProcessor();
            Telerik.Reporting.UriReportSource uriReportSource = new Telerik.Reporting.UriReportSource();
            uriReportSource.Uri = reportPathName;

            //uriReportSource.Parameters.Add();

            Console.WriteLine("Rendering Report " + Path.GetFileName(reportPathName));
            RenderingResult result = reportProcessor.RenderReport("PDF", uriReportSource, null);
            Console.WriteLine("Done Rendering Report " + Path.GetFileName(reportPathName));

            bool success = !result.HasErrors;
Petar
Telerik team
 answered on 11 Mar 2025
1 answer
69 views

I just started to evaluate the Trial Version of Reports. The good news is that I was able to re-create one of my existing Crystal Reports to a Telerik Report using the Designer. The bad news is I can't get the report to display in my existing .NET Core App(.net 9). I get the same error message in this link:

https://docs.telerik.com/reporting/knowledge-base/cannot-access-the-reporting-rest-service

I used this link below to get started. 

https://docs.telerik.com/reporting/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers

It says at the bottom of the link that there is a full example in the install folder, but the example only contains the REST service piece, not a full example where a REST is attached to a project.

Anyways, I am not having any luck troubleshooting this error message.  There is a mention of creating a .log file, but that file is not being generated for me. I tried Fiddler - have never used that before. I see this message below popped up., but no idea what that means. Do you have a full working example somewhere with a project and attached REST service?

{"message":"An error has occurred.","exceptionMessage":"Invalid URI: The hostname could not be parsed.","exceptionType":"UriFormatException","stackTrace":null}

Todor
Telerik team
 answered on 11 Mar 2025
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?