Hi,
We have a file that gets stuck in an infinite loop when we apply styles to the columns.
From my testing it appears that there is always one more column than the one we just modified and so as we loop over them, rather than altering what is there, we end up creating new columns.
I’m reporting it in case it points to some larger problem parsing this file.
Code to reproduce the issue is below using version 8.7.1.
try (InputStream inputStream = Files.newInputStream(Paths.get(“9882654.xls.xlsx”)))
{
LoadOptions loadOptions = new LoadOptions();
loadOptions.setLocale(Locale.ROOT);
Workbook workbook = new Workbook(inputStream, loadOptions);
int worksheetCount = workbook.getWorksheets().getCount();
for (int i = 0; i < worksheetCount; i++)
{
Worksheet worksheet = workbook.getWorksheets().get(i);
Cells cells = worksheet.getCells();
// Before we auto fit the columns, make sure no text is rotated as this seems to confuse it.
Style noRotation = new Style();
noRotation.setRotationAngle(0);
StyleFlag setStyles = new StyleFlag();
setStyles.setRotation(true);
for (int c = 0; c < cells.getColumns().getCount(); c++)
{
cells.applyColumnStyle(c, noRotation, setStyles);
}
}
}