This is a migrated thread and some comments may be shown as answers.

"DOCX rendering format is not available."

7 Answers 1906 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 16 Mar 2018, 10:21 AM

Hi to all,

I'm trying to create a solution console that it has generate a DOCX file from my report.

I'm using this code, but on row 34 it gives me an error "DOCX rendering format is not available."

I have already add these dll:

  • DocumentFormat.OpenXml
  • Telerik.Reporting
  • Telerik.Reporting.OpenXmlRendering
01.public class ReportHelper
02.{
03.    public static Bundle SaveAsWord(string fileName, Bundle pBundle)
04.    {
05.        Bundle bundle = new Bundle();
06. 
07.        try
08.        {
09.            //Create new CultureInfo
10.            var cultureInfo = new System.Globalization.CultureInfo(pBundle.Get(2).ToString());
11. 
12.            // Set the language for static text (i.e. column headings, titles)
13.            System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
14. 
15.            // Set the language for dynamic text (i.e. date, time, money)
16.            System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
17. 
18.            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
19. 
20.            // set any deviceInfo settings if necessary
21.            System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
22.             
23. 
24.            Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
25. 
26.            // reportName is the Assembly Qualified Name of the report
27.            typeReportSource.TypeName = "MyReportName";
28.            typeReportSource.Parameters.Add("Par1", pBundle.Get(1).ToString());
29.            typeReportSource.Parameters.Add("Par2", pBundle.Get(3).ToString());
30.            typeReportSource.Parameters.Add("Par3", pBundle.Get(4).ToString());
31.            typeReportSource.Parameters.Add("Par4", pBundle.Get(5).ToString());
32.            typeReportSource.Parameters.Add("Par5", pBundle.Get(6).ToString());
33. 
34.            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("DOCX", typeReportSource, deviceInfo);
35. 
36.            //string fileName = result.DocumentName + "." + result.Extension;
37.            string path = System.IO.Path.GetTempPath();
38.            string filePath = System.IO.Path.Combine(path, fileName);
39. 
40.            using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
41.            {
42.                fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
43.            }
44. 
45.            bundle.Add(1, true);
46.            bundle.Add(2, filePath);
47.        }
48.        catch (Exception ex)
49.        {
50.            bundle.Add(1, false);
51.            bundle.Add(2, ex.Message);
52.            bundle.Add(3, ex.StackTrace.ToString());
53.        }
54. 
55.        return bundle;
56.    }
57.}

7 Answers, 1 is accepted

Sort by
0
Accepted
Silviya
Telerik team
answered on 20 Mar 2018, 03:33 PM
Hi Dario,

From the provided information, it is not clear which version of the assemblies you are using. Depending on the version of the Open XML SDK there are two options which assembly to reference (more details in Open XML SDK for Microsoft Office help article):
1. Telerik.Reporting.OpenXmlRendering.dll supports DocumentFormat.OpenXml.dll 2.0.5022.0 and 2.5.5631.0
2. Telerik.Reporting.OpenXmlRendering.2.7.2.dll supports DocumentFormat.OpenXml.dll 2.7.2.0 and newer

Additionally, using any version newer than the listed above will require adding a bindingRedirect in the application configuration file for the DocumentFormat.OpenXml.dll assembly.

Make sure the correct combination of assemblies are used in your project. Both versions can be found in product installation folder: [installation folder]\Progress\Telerik Reporting<VERSION>\Bin\OpenXmlRendering. 
Also, CopyLocal property must be set to True to make sure that the proper DocumentFormat.OpenXml.dll is copied in the project's Bin folder.

For more detailed information about required configurations, refer to Missing DOCX, XLSX, PPTX, XPS export options in viewers or "X rendering format is not available" error message KB article.

Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dario Concilio
Top achievements
Rank 2
answered on 29 Mar 2018, 08:29 AM

Resolved all!

Thank you, Silviya!

You are wonderful! :-)

0
Rosdi
Top achievements
Rank 1
answered on 06 Nov 2018, 09:04 AM
Thanks!... helps me too!...
0
M
Top achievements
Rank 1
answered on 19 Jan 2020, 11:44 AM
Hi . I am using telerik reporting r3 2016 . I have not Telerik.Reporting.OpenXmlRendering.2.7.2.dll in my bin folder. I want to use Telerik.Reporting.OpenXmlRendering.2.7.2.dll for additional export excel for excel 2016 or above. Is any location for downloading of this dll ?
0
Neli
Telerik team
answered on 22 Jan 2020, 11:47 AM

Hello,

Telerik.Reporting.OpenXmlRendering.2.7.2.dll can be found in the installation folder of Telerik Reporting in later versions (R3 SP1 2017 +).

Regards,
Neli
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 14 Sep 2020, 05:20 PM

Hello,

I'm encountering this same error. I tried matching up the Telerik.Reporting.OpenXmlRendering.2.7.2.dll with the appropriate version of DocumentFormat.OpenXml.dll 2.7.2.0.  However, I am still receiving the error that Docx or xlsx are not available as output types. 

I'm not sure how else to troubleshoot this issue since this seems to be the only solution that I can find.  Are there any other solutions or ways that I can diagnose the underlying problem?

 

Thank you

0
Neli
Telerik team
answered on 17 Sep 2020, 09:34 AM

Hello James,

You can test to clean the project, delete the bin and obj folders and try to re-build. Please, make sure that all the assemblies are with the required versions - you may use the Modules window of Visual Studio to check what is actually loaded and used.

Let us know if the issue is resolved.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Silviya
Telerik team
Dario Concilio
Top achievements
Rank 2
Rosdi
Top achievements
Rank 1
M
Top achievements
Rank 1
Neli
Telerik team
James
Top achievements
Rank 1
Share this question
or