search
HomeSoftware TutorialOffice SoftwareJava spring MVC uses poi to do Excel import and encounters a problem. Please give me some advice.

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!

Statement
This article is reproduced at:Excel办公网. If there is any infringement, please contact admin@php.cn delete
I Always Name Ranges in Excel, and You Should TooI Always Name Ranges in Excel, and You Should TooApr 19, 2025 am 12:56 AM

Improve Excel efficiency: Make good use of named regions By default, Microsoft Excel cells are named after column-row coordinates, such as A1 or B2. However, you can assign more specific names to a cell or cell range, improving navigation, making formulas clearer, and ultimately saving time. Why always name regions in Excel? You may be familiar with bookmarks in Microsoft Word, which are invisible signposts for the specified locations in your document, and you can jump to where you want at any time. Microsoft Excel has a bit of a unimaginative alternative to this time-saving tool called "names" and is accessible via the name box in the upper left corner of the workbook. Related content #

Insert checkbox in Excel: create interactive checklist or to-do listInsert checkbox in Excel: create interactive checklist or to-do listApr 18, 2025 am 10:21 AM

This tutorial shows you how to create interactive Excel checklists, to-do lists, reports, and charts using checkboxes. Checkboxes, also known as tick boxes or selection boxes, are small squares you click to select or deselect options. Adding them to

Excel Advanced Filter – how to create and useExcel Advanced Filter – how to create and useApr 18, 2025 am 10:05 AM

This tutorial unveils the power of Excel's Advanced Filter, guiding you through its use in retrieving records based on complex criteria. Unlike the standard AutoFilter, which handles simpler filtering tasks, the Advanced Filter offers precise contro

How to use Advanced Filter in Excel - criteria range examples with formulasHow to use Advanced Filter in Excel - criteria range examples with formulasApr 18, 2025 am 09:05 AM

The tutorial shows how to use Advanced Filter in Excel and provides a number of non-trivial criteria range examples to create a case-sensitive filter, find matches and differences between two columns, extract records that match a smaller

Excel Filter: How to add, use and removeExcel Filter: How to add, use and removeApr 18, 2025 am 09:04 AM

This tutorial shows you how to effectively filter data in Excel. We'll cover filtering text, numbers, and dates, using search functions, and filtering by color or cell value. We'll also show you how to remove filters and troubleshoot common issues.

How to Make Your Excel Spreadsheet Accessible to AllHow to Make Your Excel Spreadsheet Accessible to AllApr 18, 2025 am 01:06 AM

Improve the accessibility of Excel tables: A practical guide When creating a Microsoft Excel workbook, be sure to take the necessary steps to make sure everyone has access to it, especially if you plan to share the workbook with others. This guide will share some practical tips to help you achieve this. Use a descriptive worksheet name One way to improve accessibility of Excel workbooks is to change the name of the worksheet. By default, Excel worksheets are named Sheet1, Sheet2, Sheet3, etc. This non-descriptive numbering system will continue when you click " " to add a new worksheet. There are multiple benefits to changing the worksheet name to make it more accurate to describe the worksheet content: carry

Excel Paste Special: shortcuts to copy values, comments, column width, etc.Excel Paste Special: shortcuts to copy values, comments, column width, etc.Apr 17, 2025 am 11:54 AM

This tutorial unlocks the power of Excel's Paste Special feature, showing you how to significantly boost your efficiency with paste special shortcuts. Learn to paste values, formulas, comments, formats, column widths, and more, all while avoiding co

How to add, copy and delete multiple checkboxes in ExcelHow to add, copy and delete multiple checkboxes in ExcelApr 17, 2025 am 11:01 AM

This tutorial shows you how to efficiently add, modify, and delete multiple checkboxes in Excel. Last week, we explored using checkboxes for checklists, conditional formatting, interactive reports, and dynamic charts. This week, we'll focus on the

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)