3
votes

I'm working with an existing VB.Net application that runs CRXI reports at scheduled times. It works just fine, and the reports are exported to Excel, CSV, or PDF, depending on what the schedule says the report output formatting should be.

This is the relevant section of code that sets the export options:

' Set report options
CRRep.DiscardSavedData()
CRRep.EnableParameterPrompting = False

' Set export parameters
CRRep.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile
Select Case UCase(ReportJob.OutputFormat)
    Case "XLS"
        CRRep.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTExcel80Tabular
        CRRep.ExportOptions.ExcelUseConstantColumnWidth = True
        CRRep.ExportOptions.ExcelConstantColumnWidth = 2000
        FileExtension = ".xls"
    Case "CSV"
        CRRep.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTCommaSeparatedValues
        CRRep.ExportOptions.ExcelChopPageHeader = True
        FileExtension = ".csv"
    Case Else
        CRRep.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTPortableDocFormat
        FileExtension = ".pdf"

My question is fairly simple. The users have requested a new report, which I created. They want it exported to Excel, which works just fine. But, and here's the rub, they want the header row to have a light blue background color. The report does this, and the background color shows up just fine in PDF. It also shows up fine if I run the report manually, and export it with the crviewer export button. But, when the automated report agent runs the report, and exports it to Excel, there's no background color.

I've been looking for an export option to allow the background color formatting, but haven't found one yet.

Does anyone know of such an export option?

Thank you.

1

1 Answers

1
votes

I figured out what has to be changed to allow colors.

As you can see in the question above, the format type is set to crEFTExcel80Tabular:

CRRep.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTExcel80Tabular

All I had to do was change that to:

CRRep.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTExcel97