Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOLID_FOREGROUND cannot be resolved or is not a field

SOLID_FOREGROUND cannot be resolved or is not a field

style.setFillPattern(CellStyle.SOLID_FOREGROUND);

Using 3.7 version of apache-poi I am getting the following issue. Please help on this .

SOLID_FOREGROUND cannot be resolved or is not a field

Thanks, Govardhan

like image 610
user3839679 Avatar asked Jun 19 '26 15:06

user3839679


2 Answers

According to the javadoc from version 3.17 that field was removed.

Use FillPatternType.SOLID_FOREGROUND instead.

From source code of apache-poi 3.15 I can see:

/**
 * Fill Pattern: Solidly filled
 * @deprecated 3.15 beta 3. Use {@link FillPatternType#SOLID_FOREGROUND} instead.
 */
@Removal(version="3.17")
static final short SOLID_FOREGROUND = 1; //FillPatternType.SOLID_FOREGROUND.getCode();
like image 89
cisk Avatar answered Jun 22 '26 04:06

cisk


You can use the org.apache.poi.ss.usermodel.FillPatternType. It has an attribute FillPatternType.SOLID_FOREGROUND or you can pass the value 1.

style.setFillPattern(FillPatternType.SOLID_FOREGROUND);

or

style.setFillPattern(1);

like image 40
Avelino Ferreira Gomes Filho Avatar answered Jun 22 '26 05:06

Avelino Ferreira Gomes Filho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!