views:

284

answers:

1

I'm having a heck of a time trying to manipulate my reports so that when i do a data-only excel dump, excel can recognize page headers. I was wondering two things.

1.) Is there any way to change excel export options in Visual Studio? I know you can do this with Crystal Reports standalone...but unfortunately my project requires the use of VS.

2.) How do i get the following to print:

{Report Header}
(NOTE: this is supposed to be a box containing the following info)
Query:
Sort:
Aggregation:
Date:
{Report Header}

{Page Header A}
-----------TITLE------------ -----------TITLE------------
{Page Header A}

{Page Header B}
[Page Header] [Page header] [page header] [page header] [ page header]
{Page Header B}

Every single time i print this, the Report Header gets stuffed into a row. Page Header A doesn't show up at all...and Page Header B shows up fine. Is there a way to get around this??? I tried merging both headers...but then only [Page Header] shows up and not the Titles above it.

Any ideas??

+1  A: 

I don't totally understand the issue, but I'll offer some help on changing the Export options. In code you can set them using the ExcelFormatOptions and ExportOptions.

Below is code that will allow you to Export the report as data with a column width of 100.

ExportOptions exportOpts = new ExportOptions();
ExcelFormatOptions excelFormatOpts = new ExcelFormatOptions();

excelFormatOpts.ExcelUseConstantColumnWidth = true;
excelFormatOpts.ExcelConstantColumnWidth = 100;
exportOpts.ExportFormatType = ExportFormatType.ExcelRecord;

exportOpts.FormatOptions = excelFormatOpts;
exportOpts = report_xl.ExportOptions;

Since you said "I know you can do this with Crystal Reports standalone...but unfortunately my project requires the use of VS", you should be able to use these options to set up the export how you would export to Excel from within Crystal.

I know this is not exactly what you were looking for, but since the question has been out there for a week I figure I'd throw this out there. I hope this helps.

Dusty