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

Export to DOC

20 Answers 788 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 09 Nov 2010, 06:24 PM

How do I export to WORD? I am using winform.
I can do to PDF and XLS DOC for not more!!

reportViewer1.ExportReport("DOC", new Hashtable());   // BAD
reportViewer1.ExportReport("XLS", new Hashtable());   // OK
reportViewer1.ExportReport(
"PDF", new Hashtable());   // OK


Could someone help me?

20 Answers, 1 is accepted

Sort by
0
Bernie
Top achievements
Rank 1
answered on 10 Nov 2010, 07:14 AM
Based on this document;
http://www.telerik.com/help/reporting/programmatic-exporting-report.html

I don't see a DOC output. But I do see an RTF output that could be imported into Word.

Does this help any?

Bernie
0
Steve
Telerik team
answered on 14 Apr 2011, 02:10 PM
Hi Bernie,

This is a quick follow up to let you know that in Q1 2011 we've added new export formats based on Office Open XML standards available in Microsoft Office 2007 and above:
  • Excel Worksheet (.xlsx)
  • Word Document (.docx)
  • PowerPoint Presentation (.pptx)

Kind regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Kriztine
Top achievements
Rank 1
answered on 05 Jun 2012, 08:00 AM
Hi Telerik,

I am trying to export the report programmatically but I am getting a "RendererNotAvailableException... rendering format is not available" for the following formats:

- DOCX
- HTML
- PPTX 
- XPS

Here is my code:

Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport(format, reportToExport, deviceInfo);
 reportBytes = result.DocumentBytes;
 if (reportBytes != null && reportBytes.Length > 0)
                Mailer.SendNotifications(_report, reportBytes);

Am I missing something?

Can you also give me a sample code to export in HTML format? It needs the CreateStream, right?

Your prompt reply would be greatly appreciated!


Warm Regards,

Mae
0
Steve
Telerik team
answered on 05 Jun 2012, 08:45 AM
Hello Mae,

As noted in the Deploying Applications using Telerik Reporting help section, the DOCX/PPTX/XLSX rendering extensions require Telerik.Reporting.OpenXmlRendering.dll and Open XML SDK 2.0 for Microsoft Office (DocumentFormat.OpenXml.dll v.2.0.5022.0 or above).
The XPS rendering extension requires Telerik.Reporting.XpsRendering assembly (Telerik.Reporting.XpsRendering.dll). In both cases your project should be targeting .NET 3.5 Framework or above.

About exporting to HTML, please refer to the Exporting Report Programmatically help article, specifically "Exporting a report to a multi page format" section.

All the best,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Kriztine
Top achievements
Rank 1
answered on 05 Jun 2012, 01:38 PM
Thanks Steve!

I have added all these 3 dlls but I am still getting the mentioned exception.
I am using .Net Framework 4.
Can you think of other reasons?

Warm Regards,

Mae
0
Steve
Telerik team
answered on 05 Jun 2012, 02:28 PM
Hi Mae,

These are the only requirements to have the new rendering formats available. If you can prepare a runnable project that shows the problem, we would gladly review it and advise you.

Kind regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
John
Top achievements
Rank 1
answered on 20 Nov 2012, 10:19 PM
Hello Steve,

I added the dll files you had listed and the export functions work fine in the local mode.  When I publish them to a web site I no longer am able to export to Word or Excel 2007.  What am I missing?

Thanks,
0
Steve
Telerik team
answered on 21 Nov 2012, 07:47 AM
Hello John,

Have you deployed the required assemblies for the new export formats as well? Check out the Deploying help articles depending on your project type in the Using Telerik Reporting in Applications help section.

Kind regards,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
John
Top achievements
Rank 1
answered on 21 Nov 2012, 04:05 PM
I have these assemblies in the bin folder of the web site on the server.

DocumentFormat.OpenXml.dll
Telerik.Reporting.dll
Telerik.Reporting.OpenXmlRendering.dll
Telerik.Reporting.Service.dll
Telerik.ReportViewer.WebForms.dll
Telerik.Web.UI.dll
0
Steve
Telerik team
answered on 23 Nov 2012, 10:20 AM
Hello John,

We do not see any reason why those export options are missing from your viewer. Do you exhibit the same problem if you deploy to your local IIS on the dev machine? If you can reproduce this problem on couple of machines, we would appreciate providing us with a runnable project we can run locally and investigate.

Greetings,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
John
Top achievements
Rank 1
answered on 24 Nov 2012, 02:30 PM
It works perfectly when I run it in the debug mode on my machine. It just doesn't have the options when it is published to our web server. I will work on setting up a small project with the same comditions. I'm not able to post the current project.
0
John
Top achievements
Rank 1
answered on 26 Nov 2012, 09:38 PM
Are data is in a SQL database.  We have tried to connect an XML file as a data source as well as creating a data table programmatically
but to no avail.  Any help would be appreciated other wise there is no way of sending a project that will run for you.
0
Steve
Telerik team
answered on 27 Nov 2012, 07:56 AM
Hi John,

Whether the report is databound or not is totally irrelevant in this case, as we're trying to reproduce an issue of missing export formats in the report viewer. So as far as sample report is concerned, it might as well be empty and unbound or you might not even create a report, but simply assign the base class i.e.:

InstanceReportSource reportSource = new InstanceReportSource();
reportSource.ReportDocument = new Telerik.Reporting.Report();
this.ReportViewer1.ReportSource = reportSource;

All the best,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
John
Top achievements
Rank 1
answered on 28 Nov 2012, 04:32 PM
When we created a new project everything worked as expected.  All the export options appeared in the report viewer.  The project I am having trouble with is one that we upgraded from a previous version.  Again it works fine when run locally but not when published to the web server.  This happens regardless of what machine we are publishing from.  Any thoughts on how to update this project would be greatly appreciated.
0
Steve
Telerik team
answered on 29 Nov 2012, 12:14 PM
Hello John,

You should compare the differences in the deployed assemblies for your test project as well as your web.config entries if you are using the Telerik Reporting Configuration Section in your project. You might also consider copying over the files from your existing project to a new one which you verified has them.

If you're unable to identify the problem, try to isolate the issue as much as possible and attach a runnable project in official support ticket, so we can review it and advise you.

Regards,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Calvin
Top achievements
Rank 1
answered on 13 Jun 2013, 05:43 PM
Our WPF project has references to Telerik.Reporting.OpenXmlRendering.dll, Version 6.2.13.110 and DocumentFormat.OpenXml.dll, Version 2.0.5022.0.  Our Telerik controls come from Version 2012.3.1129.45.

When you run a report, the drop down in the center of the report header includes the following four options:  Acrobat (PDF) file, Excel 97-2003, TIFF file and XPS Document.  It does not include an entry for Word DOCX.

The app.config file contains the following
  <Telerik.Reporting>
    <Extensions>
      <Render>
        <!-- Disable export of reports to formats that don't render well -->
        <Extension name="PDF" visible="true" />
        <Extension name="DOCX" visible="true" />
        <Extension name="XLS" visible="true" />
        <Extension name="IMAGE" visible="true" />
        <Extension name="XPS" visible="true" />
        <Extension name="MHTML" visible="false" />
        <Extension name="CSV" visible="false" />
        <Extension name="RTF" visible="false" />
      </Render>
    </Extensions>
  </Telerik.Reporting>

Today I added the reference to DOCX here but it did not seem to help. I have been told that the DOCX export was previously available until recently but I have not been able to confirm that.  

I removed and re-added the references to the two required DLL files at the project level but that did not seem to help either.  

Do we need any explicit reference in the app.config file to the DLL's?  

This project is in a much larger solution which consists a more than twenty projects. 

Please advise. 






0
Peter
Telerik team
answered on 14 Jun 2013, 01:35 PM
Hi Calvin,

In our local tests we are unable to reproduce the experienced difficulty on our end. Check out the demos that came with you Telerik Reporting installation and if you need additional assistance we will need the problematic project to review on our end. Thus we will appreciate if you open a support thread and send us the project.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Calvin
Top achievements
Rank 1
answered on 14 Jun 2013, 02:08 PM
Thanks for your reply. 

I would like to ask a number of specific questions.

1. Should I be using a newer version than Telerik.Reporting.OpenXmlRendering.dll, Version 6.2.13.110 ?
2.     Should I be using a newer version than DocumentFormat.OpenXml.dll, Version 2.0.5022.0.?
3.     Are the versions of these DLL's which we are using compatible with the version of Telerik controls which we are using, Version 2012.3.1129.45? 
4.  To see the Word DOCX option in the list of export options, is is necessary to include the line
	<Extension name="DOCX" visible="true" />
in the Telerik.Reporting section of our app.config file or should this appear by default if the appropriate DLL files are present?
5. Is there a requirement for any specific reference to these two DLL files in our app.config file or is it sufficient that they be referenced in the project file itself along with other DLL references?

Thanks.
0
Peter
Telerik team
answered on 17 Jun 2013, 12:55 PM
Hello Calvin,

Up to your questions:

  • The OpenXML document formats are working correctly with 6.2.13.110. You don't have to upgrade.
  • We successfully use DocumentFormat.OpenXml.dll v.2.0.5022.0 in our demos.
  • The RadControls shouldn't interfere with Telerik Reporting OpenXML rendering extensions.
  • If the required assemblies are loaded successfully in the application domain the OpenXML rendering extension will be added automatically to the export list. You don't have to specify the extension element.
  • Project reference with copy local set to true is sufficient.

You may find useful the demos that came with your Telerik Reporting installation and Deploying Web Applications help article.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Calvin
Top achievements
Rank 1
answered on 18 Jun 2013, 07:53 PM
Thank you for the specific responses Peter. They were very helpful.  

In our case, the problem turned out to be that the reference to DocumentFormat.OpenXml.dll was not in the correct project.  

For the benefit of others with a similar problem, I would note that your sample application, CSharp.ReportExamples.VS2010 does not have a reference to Telerik.Reporting.OpenXmlRendering.dll and when I removed that DLL from the project in which the reference to DocumentFormat.OpenXml.dll solved my problem, the option to export to Word (and PPT and Excel xlsx) remained available.  This experimental evidence suggests that a reference to this DLL is unnecessary.  If you believe differently, please explain.

Identifying which project should contain the reference to DocumentFormat.OpenXml.dll in our case was not so simple as it turned out not to be either the project containing the actual reports nor the project which launches the reports.  Rather it turned out to be the root client project.  Any guidance which you might give in this respect would also be welcome.  

I would also note that when I set the references to DocumentFormat.OpenXml.dll and Telerik.Reporting.OpenXmlRendering.dll, by default Copy Local was set to true for the former file and false for the latter file.  






Tags
General Discussions
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Bernie
Top achievements
Rank 1
Steve
Telerik team
Kriztine
Top achievements
Rank 1
John
Top achievements
Rank 1
Calvin
Top achievements
Rank 1
Peter
Telerik team
Share this question
or