Many people in the development of the report will encounter the same multiple forms of Excel imported into the template, and then submitted to the database. However, the problem is that online import does not support selecting multiple excel at once, you can select only one excel at a time, and you cannot import data from more than one Excel into a template without committing to it, that is, if you have data in the Web page before you import Excel, When you import Excel, the previous data is overwritten.
So is this a problem that can't be solved?
The solution is to use Finereport to customize an Excel import button, click on the button when the last import to the template data to submit, while refreshing the page, to restore the page to the original blank state, and implement the Excel import operation, and then click the Import button, Importing the next Excel, and so on, can be a lot easier to do.
For example, the following 2 samples of the same Excel imported into the Finereport template:
1. Modify the form so that it matches the title name in Excel, such as:
2. Report Reporting Property Modification
Modify the column in the report properties and the corresponding column in the database, here only need to modify the category ID corresponding to the value, modified to map (C2, "Ds2", 2, 1).
3. Custom Import button
Click Templates > Templates Web properties > Fill in Page Settings, double-click the Custom button in the toolbar, add the button to the top toolbar, and delete the built-in Import Excel button and submit button, such as:
4. Custom Event Authoring
In the solution to describe the custom button needs to do is: when the button is clicked, the last import into the template of the data to submit, while refreshing the page, so that the page back to the original blank state, and implement the Excel import operation.
In the toolbar editing screen, select the Custom button and click on custom events, such as:
Write down the JS statement in the JavaScript script, such as:
var value=contentpane.getcellvalue (0,1,2); if (value!= "") { FR. Msg.confirm (function(result) { if(result) { _g (' ${sessionid} '). Writereport (); Contentpane.refreshallsheets (); Contentpane.importexcel ();}} ); } Else { contentpane.importexcel (); }
Click Fill Preview, click the import Excel this custom button, select the first Excel to import, and then click the second need to import Excel, the page will prompt to submit the last import data, click OK, the last import data will be submitted to the database, and then pop up the file selection box, You can then select the second Excel, and so on.
To be reminded that the use of this tool to fill out the report online multiple imports of Excel only support the import of blank templates, that is, the filling template can not have the original data exist; Online multiple import Excel support a variety of styles of reporting, not only limited to the line report, but if it is non-line reporting, The control location of the report needs to be consistent with the data location in Excel, and the row report needs to keep the title name consistent.
How report tools implement multiple import of Excel