2
Reply

how to generate crystal report using code

shatrughna fuke

shatrughna fuke

Jan 13, 2011
4.7k
0

    Public Sub FLoadMainReport(ByVal StrReportName As String, ByVal DTTable As DataTable)RptMain = New ReportDocumentDTTable.WriteXmlSchema(LIPublic.StrPubXMLPath & "\" & StrReportName & ".xml")RptMain.Load(LIPublic.StrPubReportPath & "\" & StrReportName & ".rpt")RptMain.SetDataSource(DTTable)End SubFLoadMainReport(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.PrintDocumentDim PRDGMain As PrintDialog = NothingDim I As IntegerDim IntRawKind As IntegerDim NRepView As RepViewIf Trim(StrPaperSizeName) <> "" ThenPDPrint = New System.Drawing.Printing.PrintDocument()For I = 0 To PDPrint.PrinterSettings.PaperSizes.Count - 1If UCase(Trim(PDPrint.PrinterSettings.PaperSizes(I).PaperName)) = UCase(Trim(StrPaperSizeName)) ThenIntRawKind = CInt(PDPrint.PrinterSettings.PaperSizes(I).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(PDPrint.PrinterSettings.PaperSizes(I)))RpdReg.PrintOptions.PaperSize = IntRawKindRpdReg.PrintOptions.PaperOrientation = IIf(Trim(UCase(StrLandScape)) = "Y", CrystalDecisions.Shared.PaperOrientation.Landscape, CrystalDecisions.Shared.PaperOrientation.Portrait)If Not BlnDirectPrint ThenPRDGMain = New PrintDialogPRDGMain.PrinterSettings.PrinterName = PDPrint.PrinterSettings.PrinterNamePRDGMain.PrinterSettings.DefaultPageSettings.PaperSize = PDPrint.PrinterSettings.PaperSizes(I)PRDGMain.PrinterSettings.DefaultPageSettings.Landscape = IIf(Trim(UCase(StrLandScape)) = "Y", True, False)End IfExit ForEnd IfNextEnd If

    samar jeet
    April 22, 2016
    0

    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

    Fawad Mirza
    January 23, 2011
    0