Click here to Skip to main content
16,015,481 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Please help, the formatting such as page break in crystal report is missing when exported to excel and also the other page header is not printed. This is the code under the export button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New  _
            DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New ExcelFormatOptions
            CrDiskFileDestinationOptions.DiskFileName = _
                                        "d:\crystalExport.xls"
            CrExportOptions = cryRpt.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.Excel
                .DestinationOptions = CrDiskFileDestinationOptions
                .FormatOptions = CrFormatTypeOptions
            End With
            cryRpt.Export()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub


What I have tried:

I already searched google and found others also having the same problem with excel format but they received no solution to their problem.
Posted
Comments
[no name] 30-Sep-19 20:45pm    
Me thinks you expect too much from a "spreadsheet". A .pdf or .doc is a better chance.
RaydenFox 30-Sep-19 22:02pm    
My bad, I found my error was my own doing. I have 3 group sections and I put my user details at the page header section instead of in the group section.
thatraja 7-Jan-21 1:48am    
What was it? You can post it as solution here

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900