Java spring MVC uses poi to do Excel import and encounters a problem. Please give me some advice.

王林
Release: 2024-01-12 09:15:41
forward
588 people have browsed it

java spring MVC用poi做Excel导入碰到一个问题大神指教有关

java spring MVC uses poi to do Excel import and I encountered a problem, please give me some advice

public static void main(String[] args) throws IOException {

File file = new File("d:/test.xls");

InputStream is = new FileInputStream(file);

Workbook wb = new HSSFWorkbook(is);

{

System.out.println("read successfully");

return;

}

} I just wrote a test program and tried it. It is also in 2003 format. There is only one drop-down box in it

Test results: Regardless of clicking or modifying the drop-down box value, everything is normal and the workbook object can be created successfully.

Check if there are macros or anything like that in the excel you imported.

ASP extracts the value of the drop-down box, calls up the database data and displays it

Use the event! For example

area-->


 

How to set the table to be borderless when generating excel from poi

Let different types of data be displayed in different colors

In the salary table, if you want the total wages greater than or equal to 2,000 yuan to be displayed in "red", the total wages greater than or equal to 1,500 yuan to be displayed in "blue", and the total wages less than 1,000 yuan to be displayed in "brown" , others are displayed in "black", we can set it like this.

1. Open the "Salary Table" workbook, select the column of "Total Salary", execute the "Format→Conditional Formatting" command to open the "Conditional Formatting" dialog box. Click the drop-down button on the right side of the second box, select the "Greater than or equal to" option, and enter the value "2000" in the subsequent box. Click the "Format" button to open the "Format Cells" dialog box and set the "Color" of "Font" to "Red".

2. Press the "Add" button and follow the above operations to set other conditions (greater than or equal to 1500, the font is set to "blue"; less than 1000, the font is set to "brown").

3. After the settings are completed, press the "OK" button.

Take a look at the salary table. Is the total salary data displayed in different colors as you want?

The above is the detailed content of Java spring MVC uses poi to do Excel import and encounters a problem. Please give me some advice.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:docexcel.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template