Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Export To Excel in unreadable format

Further to my database connectivity on the server problem we also have an issue for an export to excel appearing in the development environment. Standard export to excel works with the below vb.net code without errors however when you come to open it with excel 2003 you get the following error.

Excel found uinreadable content in ***.xls. Do you want to reciover the contents of this workbook? If you trust it click Yes

When you click yes all formatting is removed and the advantage of using Crystal gone. The report would have 6000 or thereabouts rows, applies some formatting in terms of backcolouring rows and groups the set but other than that everything is done in the vb.net code below. Its VS 2008, Crystal 2008 inside of Visual Studio using generic list to populate the report via setdatasource. Should be fairly standard stuff

Please can someone advise as this will prevent delivery and we will have to use something other than crystal to produce this report which is a massive headache for the dev team

Thanks

Terry

Dim dfDestOptions As New DiskFileDestinationOptions

dfDestOptions.DiskFileName = strFileLoc

Dim excelFormatOptions As New ExcelFormatOptions

excelFormatOptions.ExportPageBreaksForEachPage = True

excelFormatOptions.ExcelUseConstantColumnWidth = False

'excelFormatOptions.ExcelAreaType = AreaSectionKind.GroupFooter

Dim excelExportOptions As New ExportOptions

excelExportOptions.ExportDestinationType = ExportDestinationType.DiskFile

excelExportOptions.ExportFormatType = ExportFormatType.Excel

excelExportOptions.ExportFormatOptions = excelFormatOptions

excelExportOptions.ExportDestinationOptions = dfDestOptions

'rpt.DataSourceConnections(0).SetLogon("Seymour\Helios", "kkb@reF4Tfr333")

rpt.SetDataSource(lstMagstat)

rpt.Export(excelExportOptions)

'rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, strFileLoc)

Return strFileLoc

Former Member
Not what you were looking for? View more on this topic or Ask a question