I. Overview
1. version
Report server version |
---|
10.0 |
2. Function introduction
Set printing of bills is a common requirement, that is, to print the contents of the bill accurately and accurately on a printed bill. Traditional report tools need to use a ruler to measure the position of the data in the overlay background, and then locate the position of the cell where the data is located on the screen according to the size, which is quite cumbersome. The FineReport report can scan the overlay background into a picture, directly as the report background, insert data corresponding to the background, and only print the data in the corresponding position when printing, not the background and other formats, as shown in the following effect:
II. Example
1. Bill processing
Process the bill into a picture with the same size as the actual size and a resolution of 96dpi
Scan the bill to be printed into a picture through a scanner, and then edit the picture into a picture with a resolution of 96dpi and the same size as the actual size through drawing software.
The processed picture is saved as %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Check.jpg.
After the report background is set, the report background image will be saved in the report file, and other computers also need this template. Just copy the cpt file instead of the original background image.
2. Create a new report and set the picture as the paper background
Click Template>Report Background to open the background setting dialog box, select Image, click Select Picture, select background set to Tile, as shown in the following figure:
Note: If you want to print the background of the report when printing, you need to check the Print Background.
3. Page settings
Set the page size according to the actual size of the bill, and set the page margins to 0 at the same time.
4. Design report
Add the data set ds1, the SQL statement is SELECT * FROM orders, use the order table to make a piece of billing information for each order, and finally print it out.
Drag the data column and adjust the cell so that the report content corresponds to the corresponding position of the bill:
Adjust the rightmost cell in the page line to ensure that the rightmost border line coincides with the page line at the rightmost edge of the bill background; adjust the bottom cell in the same way, as shown in the following figure:
Set the left parent cell of the signdate, customer ID, the amount payable are the cell of order ID is located, so that they are all expanded with the order ID;
Among them, the customer ID we use the data dictionary to display the corresponding customer name.
Note: Set the left parent cell of the upper left and lower right cells as the main parent of the report content, such as the order ID cell here, otherwise the data will move upward as a whole.
5. Effect preview
Save the template, click the paginaton preview, the effect is as shown in the description, you can see that each page displays a set of order invoicing information, and the data position is strictly aligned with the background. Click Print, and the receipt can be printed.
The completed report can refer to: %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Advanced\Receipt_set_print.cpt
III. Frequently Asked Questions
1. The data is shifted upward as a whole during preview
Problem description: When previewing the template, the first page is normal, and the data will shift upward from the second page, as shown in the following figure:
Cause Analysis:
Reason 1: The left parent cell in the upper left corner and the lower right corner is not set, causing the blank cells that occupy the space to be copied without following the expansion of the main cell. Without the space of these blank cells, the data is moved up as a whole.
Reason 2: The inconsistency between the report page size and the overlay background size causes the data to shift upward or downward.
Solution:
Set the left parent cell to the cells in the upper left and lower right corners of the report background area, and let them expand with the expansion of the overlay data.
Make sure that the report paper size is the same as the overlay background size.
2. The report background shifts when printing
Problem description: When printing the template, some clients print normally, and some clients print the report background will shift.
Reason analysis: due to different printers, some printers themselves will have a certain offset.
Solution: To print the client with offset, set the printing offset. For specific settings, please refer to the offset printing chapter.
3. Only one page of repeated data is displayed
Problem description: When previewing the template, only one page is displayed when there are duplicate data.
Reason analysis: The data of the leftmost parent cell of the template is set to be displayed in groups.
Solution: Set the data in the data column of the leftmost parent cell with data to list display.
4. The display effect in the designer is too different from that on the browser
Problem description: When setting the paper background for overlay printing, the display effect in the designer is very different from that in the browser. The aligned lines in the designer are not aligned in the browser (IE and Google), but they are aligned when printing. Up.
Reason analysis: Due to the computer's DPI setting, the designer effect and the browser effect are inconsistent. Generally, high-resolution customers are easy to adjust to 125% or 150% display, but this will affect the FR display effect.
Solution: Set the computer DPI back to 100%, as shown in the figure below: