Home Devices

Exporting to Excel Error

I am currently using this code to export my report to excel:
Rpt.TextFileName := RptPath ;
Rpt.DeviceType := 'XLSReport' ;
Rpt.DefaultFileDeviceType := 'XLSReport' ;
Rpt.XLSSettings.ExportComponents := [ecText,ecRichText,ecImage,ecOther];
Rpt.XLSSettings.MergeAdjacentCells := true;
Rpt.ShowPrintDialog := False ;
Rpt.Print;

Rpt.ShowPrintDialog := true ;

it's working but not every time sometimes i give me this message error

''the file format and extension of (?*filename*) don't match, the file could be corrupted or unsafe. Unless you trust it's source don't open it. Do you want to open it anyway?"

Comments

Sign In or Register to comment.