Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2009, 06:39 AM
Authorized User
 
Join Date: Nov 2005
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to joxa83 Send a message via Yahoo to joxa83
Default Export to Excel problem

Hi all,
I have following issue, I need to export report to excel in excel data only, but I also neet to keep column names which are in this case suppressed. Code I use is:
ExportRequestContext expReqCntxt = new ExportRequestContext();
CrystalDecisions.Shared.ExportOptions expOpts = new CrystalDecisions.Shared.ExportOptions();

expOpts.ExportFormatType = ExportFormatType.ExcelRecord;
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();

excelFormatOpts.ExcelTabHasColumnHeadings = true;
excelFormatOpts.ExportPageHeadersAndFooters = ExportPageAreaKind.OncePerReport;

expOpts.ExportFormatOptions = excelFormatOpts;


expReqCntxt.ExportInfo = expOpts;

byte[] bStream = null;
System.IO.Stream stRpt;

stRpt = ((CrystalDecisions.CrystalReports.Engine.ReportDoc ument)reportDoc).FormatEngine.ExportToStream(expRe qCntxt);
bStream = new byte[stRpt.Length];

stRpt.Read(bStream, 0, Convert.ToInt32(stRpt.Length));

string contentType = "application/vnd.ms-excel"; // default html

context.Response.Buffer = true;
context.Response.Clear();

context.Response.ContentType = contentType;
context.Response.BinaryWrite(bStream);
context.Response.End();
 
Old August 19th, 2009, 06:49 PM
Registered User
 
Join Date: Jul 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

you can try using GemBox .NET component for Excel. Here you can see an example how to export data to Excel with this component.

Filip





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Export then Import problem courtney_ctisn Classic ASP Basics 8 October 18th, 2007 09:57 AM
problem with export to excel supreeth Access VBA 2 September 10th, 2007 03:04 AM
Crystal Report Export problem to excel spmano1983 VB.NET 0 August 17th, 2007 01:33 AM
EXPORT DATAGRID TO EXCEL FORMATTING PROBLEM akshay144 VS.NET 2002/2003 2 October 31st, 2006 01:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.