RSS

Category Archives: Crystal Report

How to show Time from DateTime Rdlc Report Field


One of my recent requirements involved retrieving just the time portion of a records value,  generally the  we have the data type saved as a date/time format. First of all we want to show only time at rdlc report . so, this is easiest way to show time or if you want to show date.

First :: For Time.

=FormatDateTime(First(Fields!LoginTime.Value, “DS”), DateFormat.LongTime)

First :: For Date.

=FormatDateTime(First(Fields!LoginTime.Value, “DS”), DateFormat.ShortDate)

Rdlc DateTime Formula

 
1 Comment

Posted by on January 7, 2015 in Crystal Report

 

Tags: , , , ,

Could not load file or assembly ‘file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll’ or one of its dependencies. The system cannot find the file specified.


This Error give this message…..

This stuff basically happens, if you have correct setup of SBO (I wish you so:)), that between different components of your SBO SDK there are assemblies with different .NET version. Check if you have someold version of SAP BO SDK installed on your machine too. Hope this helps.

 

 

add this to your .config file (usually app.config)
<startup useLegacyV2RuntimeActivationPolicy=”true”>
<supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″/>

</startup>

 

RptError

 

 
Leave a comment

Posted by on January 17, 2014 in Crystal Report, WinForm

 

Access crystal report’s print button programmatically


You can print crystal report directly without open it / use crystal report print button

you can print report from Button click Event. Call this Method on Click Event.Below line opens up print dialog box to print without showing print preview

CrystalReport.PrintToPrinter()

Below line directly sends reportdocument to default printer.

CrystalReport.PrintToPrinter(1,true,0,0);

also you can set paper size Dynamically

CrystalReport.PrintOptions.PaperSize = PaperSize.PaperA4

 

 
1 Comment

Posted by on November 20, 2013 in Crystal Report

 

Tags: ,

How to limit export formats in crystal reports


In Crystal Report Export Format are various Types . so , if you want to show limited export format then use this following code.

C#::

int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat );
crystalReportViewer1.AllowedExportFormats = exportFormatFlags;

crystalReportViewer1.ReportSource = Report;

crystalReportViewer1.Refresh();

 

VB.Net

 Dim formats As Integer

    formats = (CrystalDecisions.Shared.ViewerExportFormats.PdfFormat Or CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat)

    CrystalReportViewer1.AllowedExportFormats = formats


http://stackoverflow.com/questions/5152018/how-to-limit-export-formats-in-crystal-reports
 
Leave a comment

Posted by on November 20, 2013 in Crystal Report

 

Tags:

Change “Main Report” tab in Crystal Report


You Can  Change the “Main Report”  tab/title to be removed in the ReportViewer.  Or you can the title be changed to it.

VB.Net 

You Can Call following function after form.show method(where form conatin crystalReportViewer Control). At the end of datasource like

//////////////////

Report.SetDataSource(ds1)
CrystalReportViewer1.ReportSource = Report
CrystalReportViewer1.Refresh()
FormatReportViewer()

/////////////////////////////////////////////Function/Method/Recommande////////////////

Private Sub FormatReportViewer()

Dim thisObj As Object

Dim MyPageView As CrystalDecisions.Windows.Forms.PageView

Dim tcontrol As Windows.Forms.TabControl

 

For Each thisObj In CrystalReportViewer1.Controls

 

Select Case UCase(thisObj.GetType.Name)

‘Case “STATUSBAR”

‘    CType(thisObj, StatusBar).Visible = False

Case “PAGEVIEW”

MyPageView = CType(thisObj, CrystalDecisions.Windows.Forms.PageView)

tcontrol = CType(MyPageView.Controls(0), TabControl)

With tcontrol

 

 

If .TabPages.Count > 0 Then

 

With .TabPages(0)

 

.Text = “Your Heading”

.Visible = True

End With

End If

End With

End Select

Next

 

End Sub

 

Other Way.

I know this is very old post, but I have found a way to hide the “Main Report” tab so I want to share it.  This seems to still be an issue in Win forms even with version 13.

 

foreach ( object control in _crystalReportViewer.Controls )

{

string name = control.GetType().Name;

if ( name == “PageView” )

{

CrystalDecisions.Windows.Forms.PageView pageView = control as CrystalDecisions.Windows.Forms.PageView;

if ( pageView != null && pageView.Controls.Count > 0 )

{

TabControl tabControl = pageView.Controls[0] as TabControl;

if ( tabControl != null && tabControl.TabPages.Count > 0 )

{

TabPage tabPage = tabControl.TabPages[0];

 

tabControl.Top = tabControl.Top – tabControl.ItemSize.Height;

tabControl.Height = tabControl.Height + tabControl.ItemSize.Height;

tabControl.Region = new Region( new RectangleF( tabPage.Left, tabPage.Top, tabPage.Width, tabPage.Height + tabControl.ItemSize.Height ) );

}

}

break;

}

}

 

 

I call this code from the load event handler.

 

Tab Print

 
Leave a comment

Posted by on November 20, 2013 in Crystal Report

 

Tags: , , ,