Rendering docx reports from a .net core library

1 Answer 56 Views
.NET Core Rendering
Mathieu
Top achievements
Rank 1
Mathieu asked on 09 Jan 2025, 03:51 PM

Hi,

 

I'm facing the following error message when I try to generate reports in the docx format: "DOCX rendering format is not available"

I've added the Telerik.Reporting.OpenXmlRendering nuget package and added the following section in the appsettings.json file of the application using the library: 

"telerikReporting": {
  "extensions": [
    {
      "name": "DOCX",
      "type": "Telerik.Reporting.OpenXmlRendering.Wordprocessing.WordprocessingReport, Telerik.Reporting.OpenXmlRendering, Version=2.7.2, Culture=neutral, PublicKeyToken=neutral"
    }
  ]

Finally, here's the code used: 

...

renderResult = reportProcessor.RenderReport("DOCX", reportSource, deviceInfo);

What am I missing ?

Thank you for the assistance

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 10 Jan 2025, 04:15 PM

Hi Mathieu,

Thank you for the provided details. Unfortunately, it is not enough for me to determine what is going wrong in your situation. What I can do is give you a demo using your code so you can see it working.

Download my attachment and open it in Visual Studio. I am targeting net9.0, but if you have a lower version instead, just manually edit the csproj to change the version. Then:

  1. Run the project
  2. Hit enter (or Y) when prompted
  3. Find the export result in the bin folder

I am targeting .net9.0, so it will be in the net9.0 folder (screenshot). Yours will be in the target folder that you've chosen:

The only note I can add is that your appsettings.json section is missing a closing curly bracket (after the extensions array). I imagine you have it in your real file, but I want to mention it anyways. This is the bracket I'm referring to.

If you continue to have trouble, please open a Support Ticket so that you can share more of your code with us privately (you have technical support during your trial).

Regards,
Lance | Senior Manager Technical Support
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Tags
.NET Core Rendering
Asked by
Mathieu
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or