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.
Use the event! For example
area-->
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!