Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I am trying to export the data in Crystal Report to HTML but not able to accomplish the same in VB.Net.

VB
 Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()
 Dim rptRepDocument As New ReportDocument
 Dim conInfo As New ConnectionInfo

rptRepDocument.RecordSelectionFormula = strSelection

mstrExportFilePath = AppTmpPath & "\tmp\" & docno & ".html"
crDiskFileDestinationOptions.DiskFileName = mstrExportFilePath
crExportOptions = rptRepDocument.ExportOptions
With crExportOptions
    .DestinationOptions = crDiskFileDestinationOptions
    .ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
    .ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40
End With

rptRepDocument.Export()       


When the code reaches the rptRepDocument.Export() then an error occurs saying:-

"Object reference not set to an instance of an object."

The above written code is not the full code but the code where error is coming.

Kindly help me resolve this.

Regards

Varun Sareen
Posted

1 solution

Without seeing full code it's tough to spot the issue. Check the below link & make sure not missing anything.
VB.NET Crystal Reports Export to PDF[^]
Exporting from Crystal Reports to PDF, Word, Excel and HTML[^]
 
Share this answer
 
Comments
Varun Sareen 10-Sep-13 4:41am    
Thanks dear. Sorry to mention here the above code is working for Excel and PDF export.
thatraja 10-Sep-13 5:42am    
Check the 2nd link & compare your code with it. Try again

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