You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mead Lai <la...@gmail.com> on 2012/03/30 08:13:33 UTC

how to set to first column and first row active.

Hello all,

I have an excel which contain 3000 rows.
but after I exported them with Poi, than open this file,
I find I can't see the header(A0:A9), but in the end of this file.
how to reset the view/windows to first row and first column.
Thanks.

Regards,
Mead

Re: how to set to first column and first row active.

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Good news and thanks for letting us know. Will file that one away for future
reference.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/how-to-set-to-first-column-and-first-row-active-tp5605774p5605920.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Re: how to set to first column and first row active.

Posted by Mead Lai <la...@gmail.com>.
sheet.showInPane((short)0, (short)0);
Now is working...
Haha.
Thanks.

Regards,
Mead


On Fri, Mar 30, 2012 at 2:49 PM, Mead Lai <la...@gmail.com> wrote:

> Thank you Mark.
>
> Following is my code, but it doesn't work at all.
> Is there some problem?
> ==================
> ==================
>
> HSSFCell cc = sourceRow.getCell(0);
> if(cc ==null){
> cc = sourceRow.createCell(0);
> }
> cc.setCellValue("");
> cc.setAsActiveCell();
> sheet.setColumnWidth(0, 3500);
> fos = new FileOutputStream(path + "/update.xls");
> wbCreat.write(fos);
>
> Regards,
> Mead
>
>
>
> On Fri, Mar 30, 2012 at 2:31 PM, Mark Beardsley <ma...@tiscali.co.uk>wrote:
>
>> The first thing that springs to mind is the setAsActiveCell() method
>> defined
>> for both XSSFCell and HSSFCell. Once you have built the worksheet, get a
>> reference for cell A1 and call the setAsActiveCell() method on that before
>> you save the file away; it might even be possible to call this method at
>> the
>> start of the process, as you are building the worksheet and creating cell
>> A1
>> (assuming that is top, left hand most cell that users can populate on the
>> sheet).
>>
>> --
>> View this message in context:
>> http://apache-poi.1045710.n5.nabble.com/how-to-set-to-first-column-and-first-row-active-tp5605774p5605803.html
>> Sent from the POI - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>

Re: how to set to first column and first row active.

Posted by Mead Lai <la...@gmail.com>.
Thank you Mark.

Following is my code, but it doesn't work at all.
Is there some problem?
==================
==================

HSSFCell cc = sourceRow.getCell(0);
if(cc ==null){
cc = sourceRow.createCell(0);
}
cc.setCellValue("");
cc.setAsActiveCell();
sheet.setColumnWidth(0, 3500);
fos = new FileOutputStream(path + "/update.xls");
wbCreat.write(fos);

Regards,
Mead


On Fri, Mar 30, 2012 at 2:31 PM, Mark Beardsley <ma...@tiscali.co.uk>wrote:

> The first thing that springs to mind is the setAsActiveCell() method
> defined
> for both XSSFCell and HSSFCell. Once you have built the worksheet, get a
> reference for cell A1 and call the setAsActiveCell() method on that before
> you save the file away; it might even be possible to call this method at
> the
> start of the process, as you are building the worksheet and creating cell
> A1
> (assuming that is top, left hand most cell that users can populate on the
> sheet).
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/how-to-set-to-first-column-and-first-row-active-tp5605774p5605803.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: how to set to first column and first row active.

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
The first thing that springs to mind is the setAsActiveCell() method defined
for both XSSFCell and HSSFCell. Once you have built the worksheet, get a
reference for cell A1 and call the setAsActiveCell() method on that before
you save the file away; it might even be possible to call this method at the
start of the process, as you are building the worksheet and creating cell A1
(assuming that is top, left hand most cell that users can populate on the
sheet).

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/how-to-set-to-first-column-and-first-row-active-tp5605774p5605803.html
Sent from the POI - User mailing list archive at Nabble.com.

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