Monday, August 31, 2009

How programmatically set Custom Page Size while exporting Crystal Report using VB.NET

How programmatically set Custom Page Size while exporting Crystal Report using VB.NET

You can easily set paper size with export functionality. Simply design crystal report as you do and bind it with database, dataset or any other data source.

When you export crystal report its takes paper size based on the crystal report design page size, if your requirement to display or print exported file in particular format then following code will help to do this.

Following example tested in

1) .NET Framework 2.0 and Visual Studio 2005

2) Crystal Report with Visual Studio 2005

DLL references requires


'Fill dataset as with desired data needs to populates crystal report
Dim dsReportOut As New DataSet
Dim rptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim reportPath As String = "CrystalReportFilePath"
Dim fileName As String = "ExportFileName.doc"
'Build the report logic here. Declare a report document.
rptDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rptDoc.Load(String.Concat(reportPath, "CrystalReportFileName.rpt"))
'Set Paper Size as A4 its letter size
rptDoc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter
--**(See below for other PaperSize options)
'Export crystal report into MSWord
rptDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, String.Concat(reportPath, fileName))
--***(See below for other Export Format Options)
'Open(Exported file)MSWord File
Dim ProcessStartInfo As New System.Diagnostics.ProcessStartInfo
ProcessStartInfo.FileName = String.Concat(reportPath, fileName)
ProcessStartInfo.WindowStyle = ProcessWindowStyle.Maximized

** Others PaperSize Options

*** Others Export Options


Anonymous said...
[ female orgasm frequency age viagra]
[url=""]the christmas[/url]
[url=""]charles dickens christmas carol[/url]
[url=""]christmas e card[/url]
unique christmas gift for boyfriend
[url=""]christmas carol torrent[/url]
[ christmas flower arrangements]
[ office christmas party game]
[ invitation party christmas invitation]
[url=""]online photo christmas card[/url]
[ christmas gift card holder]

Anonymous said...

Top Internet sites
[url=]bad mortgage credit j[/url]
[url=]aveeno care eczema k[/url]
[url=]augmentin as treatment 816[/url]
[url=]complication an after i[/url]
[url=]success clomid overweight N[/url]
[url=]market sovereign emerging i[/url]
[url=]annual credit report map 769[/url]

We will be glad to see you

Anonymous said...

free personals for police officers [url=]site couples dating finding fun minded[/url] united kingdom singles free datingsites with free membership