So I found a way thats working for me...
is there a better way to handle this? But currently its working for my
program
Helfi wrote:
>
> private CellStyle copyStyle(CellStyle sourceStyle, Workbook newWorkbook,
> Workbook oldWorkbook) {
> //Create new font
> Font fontOld =
> oldWorkbook.getFontAt(sourceStyle.getFontIndex());
> Font fontNew = newWorkbook.createFont();
> fontNew.setBoldweight(fontOld.getBoldweight());
> fontNew.setColor(fontOld.getColor());
> fontNew.setFontHeight(fontOld.getFontHeight());
> fontNew.setFontName(fontOld.getFontName());
> fontNew.setItalic(fontOld.getItalic());
> fontNew.setStrikeout(fontOld.getStrikeout());
>
> //Create new style
> CellStyle style = newWorkbook.createCellStyle();
> //Apply old values to new style
> style.setFont(fontNew);
>
> style.setFillForegroundColor(sourceStyle.getFillForegroundColor());
> style.setFillPattern(sourceStyle.getFillPattern());
> style.setBorderBottom(sourceStyle.getBorderBottom());
> style.setBorderLeft(sourceStyle.getBorderLeft());
> style.setBorderRight(sourceStyle.getBorderRight());
> style.setBorderLeft(sourceStyle.getBorderLeft());
> style.setDataFormat(sourceStyle.getDataFormat());
>
> style.setFillBackgroundColor(sourceStyle.getFillBackgroundColor());
> style.setRotation(sourceStyle.getRotation());
>
> style.setVerticalAlignment(sourceStyle.getVerticalAlignment());
> style.setWrapText(sourceStyle.getWrapText());
> //return new created Style
> return style;
> }
>
>
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Apply-HSSFCellStyle-on-XSSFCells-and-vice-versa-tp4826014p4829173.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]