protected void createFakeTemplateCellsForEmptyOnes ( Range oneRowRange , Map < CellReference , Cell > cellsForOneRowRange , List < Cell > templateCells ) { if ( oneRowRange . toCellReferences ( ) . size ( ) != templateCells . size ( ) ) { final HashBiMap < CellReference , Cell > referencesToCells = HashBiMap . create ( cellsForOneRowRange ) ; for ( CellReference cellReference : oneRowRange . toCellReferences ( ) ) { if ( ! cellsForOneRowRange . containsKey ( cellReference ) ) { Cell newCell = Context . getsmlObjectFactory ( ) . createCell ( ) ; newCell . setV ( null ) ; newCell . setT ( STCellType . STR ) ; newCell . setR ( cellReference . toReference ( ) ) ; templateCells . add ( newCell ) ; referencesToCells . put ( cellReference , newCell ) ; } } templateCells . sort ( ( o1 , o2 ) -> { CellReference cellReference1 = referencesToCells . inverse ( ) . get ( o1 ) ; CellReference cellReference2 = referencesToCells . inverse ( ) . get ( o2 ) ; return cellReference1 . compareTo ( cellReference2 ) ; } ) ; } }
XLSX document does not store empty cells and it might be an issue for formula calculations and etc . So we need to create fake template cell for each empty cell .