Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Data(Report) in PrintDocument, How can i Save/Export it in .Pdf ?

I want to save And Mail my Report, I have Mail Application, But i Could Save my Data(Report) Which is in PrintDocument/PrintPreviewControl. So, Please tell me the way by which i can Export data from PrintDocumnet/PrintPreviewControl to .pdf/.Word/.Xls....
Posted

Use ReportDocument instead of PrintDocument.

MIDL
reportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:\Files\Report.pdf");


Check for other option of ExportFormatType

Hope this will help :)
 
Share this answer
 
Comments
bhavik s 28-May-11 5:53am    
Thanx For Reply,

But, I have use PrintDocumnet So Many times and i have Many Project thats work on PrintDocument With PrintPreviewControl...

How can i convert my All PrintDocument's Coding To ReportDocument?
'coz PrintDocument's Codes and ReportDocumnet's Codes are too different....

In ReportDocumnet i could not assign PaperSize, Paper Margin,.Etc...

Is There Any Other Way for pdf??
AbhijeetB 1-Jun-11 10:33am    
See the solution3
Thanx For Reply,

But, I have use PrintDocumnet So Many times and i have Many Project thats work on PrintDocument With PrintPreviewControl...

How can i convert my All PrintDocument's Coding To ReportDocument?
'coz PrintDocument's Codes and ReportDocumnet's Codes are too different....

In ReportDocumnet i could not assign PaperSize, Paper Margin,.Etc...

Is There Any Other Way for pdf??
 
Share this answer
 
I dont think PrintDocument will help. The only option with PrintDocument is use 'PDF xChange' as a printer on Print Dialog which will save the report as PDF.

About the ReportDocument... You can set the printing parameters like PaperSize, Margins etc in
ReportDocument.PrintOptions

I dont think it will be difficult to use ReportDocument instead of PrintDocument. Here's a basic code

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(< YOur report file name/path >);

reportDocument.SetDataSource(  );

reportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:\Files\Report.pdf");

reportDocument.Close();
reportDocument.Dispose();
 
Share this answer
 

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