Home > Back-end >  Using the poi import EXCEL, empty cell how to change the cell background color
Using the poi import EXCEL, empty cell how to change the cell background color

Time:10-13

Is sheet. GetRow (I). The getCell (j)=null
Is equal to null cannot setCellStyle, thinks that the cell is empty, sheet. GetRow (I). The getCell (j) setCellStyle null pointer exception, how to solve

CodePudding user response:

Your business needs is to get the data for the empty cell change color? This is not done the general is empty does not handle the search didn't find a solution to help the top under it ~ ~

CodePudding user response:

reference 1st floor who_is_xiaoming response:
your business needs is to get the data for the empty cell change color? This is not done the general is empty does not handle the search didn't find a solution to help the top under it ~ ~

Import EXCEL has mandatory, if he didn't fill in the one the color of the cell is changed, it failed to check the EXCEL when, you can see is clear which have problem

CodePudding user response:

If it is understandable for this: do you have a query of data in field is mandatory, but the user can not fill; If the user doesn't fill in this field is empty, and then you query out export,
So when in fact you can query processing, do a data is empty at the time of processing, such as the field is integer, if is empty, you can set to 0. Then export should be good judgment in the time of personal humble opinion, couldn't think of other solutions

CodePudding user response:

The
reference 3 floor who_is_xiaoming response:
if it is can be understood as such: do you have a query of data in field is mandatory, but users can not fill; If the user doesn't fill in this field is empty, and then you query out export,
So when in fact you can query processing, do a data is empty at the time of processing, such as the field is integer, if is empty, you can set to 0. Then export should have good judgment in the time of personal humble opinion, think of a solution to other
I'm in the import EXCEL data, table must fill the user must fill in, didn't fill in required fields is empty, and put the empty on the EXCEL spreadsheet cell in a color, a prompt role, now is the judgment is empty, but can't null setCellStyle and other attributes, just wanted to ask how to solve

CodePudding user response:

Such a great spirit to solve it for you a small white don't understand ~ ~

CodePudding user response:

To creat the form empty words

CodePudding user response:

If null filled with an empty string

CodePudding user response:

Cell Cell=sheet. GetRow (I). The getCell (j);
If (cell==null) {
Cell=sheet. GetRow (I). CreateCell (j);
}
  • Related