Crystal Reports - Excel Options when exporting

G

Guest

I am exporting a report to an Excel file. Whatever options I use for the
formatting the results remain the same. I have set the
ExcelTabHasColumnHeadings to true and false without any difference. I have
set the ExcelUseConstantColumnWidth to true and thenset the width to
different values and have seen no changes. The code I am using is shown below.

private void ExportToExcel
(CrystalDecisions.CrystalReports.Engine.ReportDocument Report, string
fileName, bool hasColumnHeaders, double columnWidth)
{
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions
();
DiskFileDestinationOptions diskOpts = new
DiskFileDestinationOptions();

// Set the excel format options.
excelFormatOpts.ExcelTabHasColumnHeadings = false;
excelFormatOpts.ExcelUseConstantColumnWidth = hasColumnHeaders;
excelFormatOpts.ExcelConstantColumnWidth = columnWidth;
Report.ExportOptions.ExportFormatType = ExportFormatType.Excel;
Report.ExportOptions.FormatOptions = excelFormatOpts;
// Set the disk file options and export.
Report.ExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile;
diskOpts.DiskFileName = fileName;
Report.ExportOptions.DestinationOptions = diskOpts;
Report.Export ();
}


Thanks for any help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top