Interviews2 answers
how to generate crystal report using code
2 Answers
Public Sub FLoadMainReport(ByVal StrReportName As String, ByVal DTTable As DataTable)
RptMain = New ReportDocument
DTTable.WriteXmlSchema(LIPublic.StrPubXMLPath & "\" & StrReportName & ".xml")
RptMain.Load(LIPublic.StrPubReportPath & "\" & StrReportName & ".rpt")
RptMain.SetDataSource(DTTable)
End Sub
FLoadMainReport(StrReportFor, DTTemp)
FShowReport(ReportName, Me.MdiParent, Me.Text)
Public Sub FShowReport(ByVal RpdReg As CrystalDecisions.CrystalReports.Engine.ReportDocument, _
ByVal FrmMDI As Form, ByVal StrReportCaption As String, Optional ByVal BlnDirectPrint As Boolean = False, _
Optional ByVal StrPaperSizeName As String = "", Optional ByVal StrLandScape As String = "")
Dim PDPrint As System.Drawing.Printing.PrintDocument
Dim PRDGMain As PrintDialog = Nothing
Dim I As Integer
Dim IntRawKind As Integer
Dim NRepView As RepView
If Trim(StrPaperSizeName) <> "" Then
PDPrint = New System.Drawing.Printing.PrintDocument()
For I = 0 To PDPrint.PrinterSettings.PaperSizes.Count - 1
If UCase(Trim(PDPrint.PrinterSettings.PaperSizes(I).PaperName)) = UCase(Trim(StrPaperSizeName)) Then
IntRawKind = CInt(PDPrint.PrinterSettings.PaperSizes(I).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(PDPrint.PrinterSettings.PaperSizes(I)))
RpdReg.PrintOptions.PaperSize = IntRawKind
RpdReg.PrintOptions.PaperOrientation = IIf(Trim(UCase(StrLandScape)) = "Y", CrystalDecisions.Shared.PaperOrientation.Landscape, CrystalDecisions.Shared.PaperOrientation.Portrait)
If Not BlnDirectPrint Then
PRDGMain = New PrintDialog
PRDGMain.PrinterSettings.PrinterName = PDPrint.PrinterSettings.PrinterName
PRDGMain.PrinterSettings.DefaultPageSettings.PaperSize = PDPrint.PrinterSettings.PaperSizes(I)
PRDGMain.PrinterSettings.DefaultPageSettings.Landscape = IIf(Trim(UCase(StrLandScape)) = "Y", True, False)
End If
Exit For
End If
Next
End If
samar jeetPosted Apr 22, 2016, 6:45 AM EDT
dear if u want to know about this contact me on this mail ID : [email protected]
i will give u the project on it which will help u
i will give u the project on it which will help u
Fawad MirzaPosted Jan 23, 2011, 8:09 AM EST

