Symptom
You may want to change the data source location of one or many reports at design time. For example, you may have recently changed the location of your database, and you need to run a batch program that will alter the Crystal Reports data source location.
Assume that you have a report called 'c:reportstest.rpt'. This report has a data source location named Northwind eal (please refer to the See Also section of this Note for more details about the data sources).
Now you want to change the data source location for one or many reports at the push of a button. The new data source has exactly the same structure as the previous data source - only its location is now different (as set in the ODBC Data Sources).
When you start Crystal Reports 10, generally you want to do one of three things: create a report, modify a report, or run a report against the data in your database. Reports take data from a database, process it, format it, and then output it to a printer, computer screen, or Web site.
The issues I am facing is the watermark is being displayed in front of the lines. The Data output is being displayed in front of the water mark and printed correctly (how you would expect it to work). But as soon as I add any lines into the report then the lines are displayed behind the watermark. This part mainly provides C#.NET developers with detailed guide on opening and running a C# application for adding watermark on image. Specific tips are listed below. (For VB.NET developers, please go to add watermark to images in VB.NET. Want to use image and document watermark function in WinForms or web application, please go to add.
How To Add Watermark In Crystal Report In C# Word
Resolution
How to add fields to a report. Open the report. To open the report, load the Crystal Reports application. When Crystal Reports is open, the report that the field is being added to can be opened by clicking on open and selecting the report. Refresh the fields in the report. Code 128 Barcodes in Crystal Reports. This tutorial shows how to add Code 128 B barcodes to your Crystal Reports. See the video or simply follow the steps below.
In Visual Studio .NET, use a ReportDocument object to load a RPT file, change the data source location then export the ReportDocument to a RPT file on the hard drive to persist the changes.
Follow these steps:
1. In Windows, on the Start menu, click Run, then type 'odbcad32'. Click OK. The ODBC Data Source Administrator dialog box appears.
2. Create two System DSNs; one named Northwind eal and the other named Northwind van (refer to the See Also section).
3. Create a new Crystal report with its fields based on the Northwind eal DSN. Save this report as C:reportstest.rpt.
4. Create a new Visual Studio project.
5. In Visual Studio, add CrystalDecisions.CrystalReports.Engine and CrystalDecisions.Shared as references.
6. Add a new form with a button. After adding the button to the form, double-click the button to set up the Button1_Click procedure. Add the following code (VB or C#) to the Button1_Click procedure:
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rep As ReportDocument = New ReportDocument
Dim path As String
Dim done As Boolean
'specify path to the report
path = 'c:reportstest.rpt'
'load the report
rep.Load(path)
'use Logon method from c2011464
done = Logon(rep, 'Northwind van', 'Northwind', '<username>', '<password>')
rep.ExportToDisk(ExportFormatType.CrystalReport, 'c:reportstest_export.rpt')
rep.Refresh()
rep.Close()
End Sub
C#
private void Button1_Click(object sender, System.EventArgs e)
{
ReportDocument rep = new ReportDocument();
//specify path to the report
string path = 'c:reportstest.rpt';
//load the report
rep.Load(path);
//use Logon method from c2011464
done = Logon(rep, 'Northwind van', 'Northwind', '<username>', '<password>');
rep.ExportToDisk(ExportFormatType.CrystalReport, 'c:reportstest_export.rpt');
rep.Close();
}
7. Now you need to add code to change the data source. Add the code from Note 1214777 directly after the Button1_Click procedure.
8. Create an output directory on your test computer called C:reports.
9. Build and run the solution.
10. The new report will save as C:reportstest_export.rpt.
11. Open this new report, and refresh it once (you may have to log on to the database again). It will contain the new data source location as was specified in the code.
|
See Also
Type: ODBC (RDO)
Data Source Name: Northwind eal
User ID: sa
Database: Northwind
Type: ODBC (RDO)
Data Source Name: Northwind van
User ID: sa
Database: Northwind
Keywords
.Net data source location odbc , 2754396 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To
Product
- Crystal Reports Tutorial
- Crystal Reports Useful Resources
- Selected Reading
As discussed earlier, Crystal Reports by default provides five main sections −
- Report Header
- Page Header
- Body
- Report Footer
- Page Footer
Here, we will learn how to insert, hide, and delete sections in Crystal Report for Enterprise 4.x.
To insert a section in any of the report section, select the section → Right click and Insert.
You can use Hide and move option to hide a section or to move the section up and down.
Format Section option allows you to format the section properties. It includes −
- Name
- Color
- Size
Size option allows you to adjust the height of the section.
To keep a section from breaking across pages −
If an element is longer than one page then it prints across multiple pages. To avoid this you can use Paging option.
Right click a section and click format section → Paging → Select Avoid Page Break and click Close.
How To Add Watermark In Crystal Report In C# 2017
Now let us see how to insert, hide and delete sections in Crystal Report 2013.
Section Expert as shown in the following image is used to manage sections in the report.
To insert a new section you need to −
Click Section Expert button as shown in the following image (Section Expert contains a list of all the sections in the report) → Select section and click insert.
A new section will appear in the report.