Export unformatted Excel data from Crystal Reports - c#

I need to export excel file with crystal report.
Is there any way to export data only without formatting by using code?

You can export data shown in the report without formatting, in different ways:
1- Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.
2- Call ExportToHttpResponse method
CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");`
3- Call ExportToDisk method
reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");
4- Export dataset to excel (Look at Ahmed answer)
You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.
ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them..

Related

Exporting a SSRS 2008 report to RTF

I am using Microsoft.ReportViewer to display SSRS reports from my C# desktop application. The ReportViewr by default provides the 3 modes of export features, 1. Excel. 2. Word, 3. PDF. Now we want another export capability of RTF. Does any one have any idea how to convert the SSRS reports to RTF format?
SQL Server Reporting Services does not support RTF as a rendering format out of the box. If you want this functionality you have two options:
1) Develop a custom rendering extension
or
2) Buy a third-party solution, for example this one
If you can export it to a word file, you can use the word interop to read the file, select all, copy and paste to a richtextbox. You can get the rtf format from the RTF property of the richtextbox.

Display PDF and Excel export options in Crystal Reports?

I need to Remove the Word, Rpt and rtf option in Crystal report Export option. Is it possible?
I need only two option pdf and Excel. If possible please advice.
Using CRVS2010 , you can remove unwanted export Option.
A new feature of CRVS2010 is the ability to modify the available export formats from the viewer export button. The following C# sample code demonstrates how to set the CrystalReportViewer to export only to PDF and Excel file formats:
int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
CrystalReportViewer1.AllowedExportFormats = exportFormatFlags;
For More Details Please refer below link..
http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2011/01/26/export-file-formats-for-sap-crystal-reports-for-vs-2010

Export Data to Excel without Server-side install

I want to export my data from grid view to the excel. Unfortunately i came to know that there is no excel software on server side. Is there any way that i can still export data in excel format without having excel software on server side.
Thanks.
you can create a CSV format text file, which excel can understand.
This question also outlines some other options you might be able to use, with pros and cons of both.
This must be one of the most asked questions on Stackoverflow.
See Create Excel (.XLS and .XLSX) file from C# For lots of suggestions and a whole list of linked questions.
One trick you can use it to export the html table to the client with the extension of .xls. When the user opens the document with Excel and resaves it will become a real excel document. The fun part is it will retain most of the formatting from the HTML view. This works with HTML/TABLES, I'm not sure about DIV/SPAN/CSS.

Dataset to excel

I'm developing an application that as to export a dataset to excel, this dataset have 3 tables and the relation between them, I would like to export this to a single excel sheet where for each parent table there is a '+' sign that when expanded shows the child values related to it. To export a single table to excel I know how to do it, but to create this type of relation I have no idea how to do it, do I have to create a macro on the excel file?
I use a DevExpress Reports or a ActiveReports for this. I create a normal report and next i save it in xls, and Done. Its very complicated to this using us code. Its more easy to use a third-party components
There's a free tool: https://closedxml.codeplex.com/ to create XLSX outputs from code.

How to display a SQL Reporting Service report in Excel

At the moment i am using VSTO to take a SQL Reporting Services report and display it in Excel 2003 using the ReportViewer control. So bascially on a winform hosted inside Excel.
But i also need to be able to display it without the ReportViewer control i.e. just straight into the cells of my Excel sheet.
I'm wonder how I should go about this.
I can retreive the report in CSV format. So should I just loop through the cvs formatted report and insert directly into my Excel sheet one row after another or is there a better way?
You might want to look at what I did trying to print a RS report without user input. It uses RS's web services endpoint to deliver the report into the application. The only difference is that instead of using an IMAGE format, you'd use an EXCEL format on the render call.
Viewing the Reporting Services reports in a web browser has an Export option right at the top of the report. Excel is one of those options. It even exports the formatting. Note that this is for SSRS 2005 - I do not know if anything changed in SSRS 2008.
Can you not just dump the data directly into Excel using CopyFromRecordset?

Categories