How to print a Web format report as a different style

Source: Internet
Author: User
Tags idn print format

We often have to print the report, but also encountered the trouble of printing, such as sometimes we do not want to strictly follow the report above the style, according to the actual application may have other styles more suitable, how to do it, in fact, the report software can be set, today I will take you to understand!

1. Description of the problem

For the completion of the network format report, there is a check box in front of each line, you want to implement the click on the page Set the Print button to the selected check box to print the values in a certain style, such as columns, pages fixed display a few lines and other formats.

2. Realization of Ideas

You can define another template with fixed format, the data of this template is filtered according to the value selected in the report of the filling net format, and in the report of the filling net format, you need to define JS,JS in the button's click event to get the data of the selected row first. Then call Finereport (the Report development tool used in the instance is Finereport) for the built-in printing method, adding the selected value as a parameter to the URL of the printing method to the printed template.

3. Example

The preview template effect looks like this

With some data selected to print in the style shown, let's look at the specific implementation steps below.

3.1 New required Print format template

· Defining the data Set

Since this template is to be printed according to the selected values, define the parameters in this template, where we define the parameters as DataSet parameters.

To create a new workbook, add the DataSet Ds1,sql statement as: SELECT * from order where order ID in (${id}).

· Design of Table sample

Design the sample as the effect you want to print, where we set the template to the following style:

Sets the Zovig of the B2 cell to none and sets the Zovig of the remaining cells to B2.

Set the B3 and D3 patterns.

The template can also be column-divided.

· Save Template

Save the template, the specific settings can refer to the template:%fr_home%\webreport\web-inf\reportlets\doc\form\formfaq\printcol.cpt

3.2 Modifying the preview template

· Open a template

Open the template:%fr_home%\webreport\web-inf\reportlets\doc\form\lineform\lineform7.cpt.

· Modify a template

This template, we just modify the name of the button and the button JS, so we change the button name to "Print", and JS modified to the following code:

var $span = $ ('. Fr-checkbox-checkon '); Gets the selected check box var darray = [];var $tds = $ ("TD"). has ($span);  Get the cell for the check box selected for (var i = 0, len = $tds. length; i < Len; i + +) {//traverse the selected cell var id = $ ($tds [i]). attr ("id"); Adds the id attribute to the selected cell var idn = Id.replace ("A", "B");    Replace the column A of the check box with the B-column Var Vv=document.getelementbyid (IDN) where the customer number is located. InnerHTML;  Gets the data Darray.push (VV) for column B of the selected cell;  }fr.dourlpdfprint ("${sevleturl}reportserver?reportlet=/doc/form/formfaq/printcol.cpt&id=" +darray); Call the Print method, the URL is the template path that was done before



Note: If you get the VV value as a string, you need to modify it to Darray.push ("'" "+vv+" ' ") to put it in the array.

· Save Template

Save the template, the specific settings can refer to the template:%fr_home%\webreport\web-inf\reportlets\doc\form\formfaq\printotherstyle.cpt.

3.3 Effect View

Fill in the Preview printotherstyle.cpt, select a few lines of data, click the Print button, will follow the effect of printing.


How to print a Web format report as a different style

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.