Bug 65220 - auto size column generates error with custom formats when carrying colors
Summary: auto size column generates error with custom formats when carrying colors
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.0.0-FINAL
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-07 16:26 UTC by Oscar Andres Rasmo Lopez
Modified: 2021-04-07 16:29 UTC (History)
0 users



Attachments
ide problem trace (158.17 KB, image/jpeg)
2021-04-07 16:29 UTC, Oscar Andres Rasmo Lopez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oscar Andres Rasmo Lopez 2021-04-07 16:26:07 UTC
When the auto size is being used, it is taking albertence with colors that are in the main color palette, such as magenta, but if we try to do it with the colors according to the theme that are supported by the free ones, such as color 1, color 2 color 3 etc, it outputs a line message trace the error happens in the regular expression used in org.apache.poi.ss.format, when the format has 2 parts the library works correctly with the 8 colors or with the colors per theme color 1, color 2, etc

But when the one third part there is an error with two main palette colors, the mangenta and cyan, it says that it does not recognize them but if we send a theme color there is a critical error and it gets a trace error

this formar have a problem 
[red]0;[magenta]-0;[blue]@


abr 07, 2021 11:15:19 AM org.apache.poi.ss.format.CellFormatPart getColor
ADVERTENCIA: Unknown color: "magenta"

but remove thrid parameter and works


now if we put a theme color it gives us an error trace like this
[red]0;[magenta]-0;[color 1]@

abr 07, 2021 11:21:33 AM org.apache.poi.ss.format.CellFormatPart getColor
ADVERTENCIA: Unknown color: "magenta"
abr 07, 2021 11:21:33 AM org.apache.poi.ss.format.CellFormat <init>
ADVERTENCIA: Invalid format: "[color 1]@"
java.lang.IllegalArgumentException: Unsupported [] format block '[' in '[color 1]@' with c2: null
	at org.apache.poi.ss.format.CellFormatPart.formatType(CellFormatPart.java:373)
	at org.apache.poi.ss.format.CellFormatPart.getCellFormatType(CellFormatPart.java:287)
	at org.apache.poi.ss.format.CellFormatPart.<init>(CellFormatPart.java:191)
	at org.apache.poi.ss.format.CellFormat.<init>(CellFormat.java:188)
	at org.apache.poi.ss.format.CellFormat.getInstance(CellFormat.java:162)
	at org.apache.poi.ss.usermodel.DataFormatter.getFormat(DataFormatter.java:331)
	at org.apache.poi.ss.usermodel.DataFormatter.getFormat(DataFormatter.java:297)
	at org.apache.poi.ss.usermodel.DataFormatter.getFormattedNumberString(DataFormatter.java:858)
	at org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:1015)
	at org.apache.poi.ss.usermodel.DataFormatter.formatCellValue(DataFormatter.java:965)
	at org.apache.poi.ss.util.SheetUtil.getCellWidth(SheetUtil.java:181)
	at org.apache.poi.ss.util.SheetUtil.getColumnWidthForRow(SheetUtil.java:313)
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:266)
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:244)
	at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:523)
	at com.siesa.cobol.GeneradorXls.convertirArchivo(GeneradorXls.java:79)
	at com.siesa.cobol.PasarParametros.execute(PasarParametros.java:73)
	at com.siesa.cobol.PasarParametros.main(PasarParametros.java:24)


If I send the format like this it works so it is not a problem of the color of the excel theme
[color 3]0;[clor 1]-0

this only happens when autosize is used
for (int c = 0; c < colNum; c++) hoja.autoSizeColumn(c, true);
Comment 1 Oscar Andres Rasmo Lopez 2021-04-07 16:29:18 UTC
Created attachment 37800 [details]
ide problem trace