You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Alejandro Salas <kr...@yahoo.com.INVALID> on 2014/08/23 05:12:09 UTC

Help migrating setRepeatingRowsAndColumns.

Hello everyone, 

I've been hired to update the dependencies from an old system which includes poi to create Excel files. I've used Poi but about 7 years ago.

I'm a little confused with the change of workbook.setRepeatingRowsAndColumns() and the fact that now it's been split into two methods and CellRangeAddress.

One of the calls I have encountered is the following:
workbook.setRepeatingRowsAndColumns(0, 0, 0, 0, 1);


Now, looking at the deprecated code that translates into:
sheet.setRepeatingRows(new CellRangeAddress(0, 1, -1, -1));

sheet.setRepeatingColumns(new CellRangeAddress(-1, -1, 0, 0));
 
Is there a better way to do it?
Any pointers are appreciated.

Thanks!

Re: Help migrating setRepeatingRowsAndColumns.

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

I think this is the correct way to do this nowadays.

The CellRangeAddress has the advantage that it allows a more
meaningful way of addressing, e.g. it allows something like this:

          sheet1.setRepeatingRows(CellRangeAddress.valueOf("1:4"));
          sheet1.setRepeatingColumns(CellRangeAddress.valueOf("A:A"));

which is much more readable.

See the Javadoc of CellRangeAddress.valueOf() for the supported ways
of addressing ranges.

Dominik.

On Sat, Aug 23, 2014 at 5:12 AM, Alejandro Salas
<kr...@yahoo.com.invalid> wrote:
> Hello everyone,
>
> I've been hired to update the dependencies from an old system which includes poi to create Excel files. I've used Poi but about 7 years ago.
>
> I'm a little confused with the change of workbook.setRepeatingRowsAndColumns() and the fact that now it's been split into two methods and CellRangeAddress.
>
> One of the calls I have encountered is the following:
> workbook.setRepeatingRowsAndColumns(0, 0, 0, 0, 1);
>
>
> Now, looking at the deprecated code that translates into:
> sheet.setRepeatingRows(new CellRangeAddress(0, 1, -1, -1));
>
> sheet.setRepeatingColumns(new CellRangeAddress(-1, -1, 0, 0));
>
> Is there a better way to do it?
> Any pointers are appreciated.
>
> Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org