i am trying copy cells from one row to the one below. To copy the comments and cellvalues works fine. Now if I set a background-color in Excel and want to just copy it to the new cell, it doesn't work. Either there is just no color after copying or the background is black. I tried that:
style2.setFillBackgroundColor(cell_master_alt.getCellStyle().getFillBackgroundColor());
style2.setFillForegroundColor(cell_master_alt.getCellStyle().getFillForegroundColor());
style2.setFillPattern(CellStyle.SOLID_FOREGROUND); or
style2.setFillPattern(cell_master_alt.getCellStyle().getFillPattern());
cell_master_neu.setCellStyle(style2);
After a few hours without any progress, I looked into the foreground- and background-color of the cell I want to copy. There I found RGB values. Now I want to make a new Cellstyle with that values, but that doesn't work as well. First I try this:
style_new.setFillForegroundColor(new XSSFColor(new java.awt.Color(128,128,128)));
but there is an error message:
The method setFillForegroundColor(short) in the type CellStyle is not applicable for the arguments (XSSFColor)
What is wrong with that?
Thanks