You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Nick Burch <ni...@alfresco.com> on 2011/07/01 18:35:17 UTC
Re: HSSFRow.setRowStyle -> XSSFRow.??? <- no such method
On Tue, 28 Jun 2011, Alexander Hörnlein wrote:
> ok - i created a xlsx with the style of the first row + the first cell
> set to the same style and another one where only the first cell has the
> style and the only difference was
>
> <row ...> ...
> vs.
> <row ... s="1" customFormat="1">....
Looks like it it's similar to cells, handy. Any chance you could create a
new bug in bugzilla, and upload a sample file which we can use in a unit
test?
> so i guess the code from XSSFCell should work for XSSFRow (+ customFormat),
> so it should be something like:
>
> public void setCellStyle(CellStyle style) {
> if(style == null) {
> if(_row.isSetS()) {
> _row.unsetS();
> _row.unsetCustomFormat();
> } else {
> XSSFCellStyle xStyle = (XSSFCellStyle)style;
> xStyle.verifyBelongsToStylesSource(_stylesSource);
>
> long idx = _stylesSource.putStyle(xStyle);
> _row.setS(idx);
> _row.setCustomFormat(true);
> }
> }
>
> the _stylesSource of XSSFRow could be handled exactly like for XSSFCell
> (it's only a pointer to row.getSheet().getWorkbook().getStylesSource();
Looks correct. Please include this in the bug report, and I'll have a go
at writing a unit test for it, and I'll then commit it for you
Cheers
Nick