You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Khanh Tran <tr...@gmail.com> on 2007/03/12 11:36:48 UTC

Deleting column

Dear experts, 
Is there any way to delete a column/row in Excel file using POI?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


RE: Deleting column

Posted by Khanh Tran <tr...@gmail.com>.
I tried setCellNum() as your advice. It works, but for merged cells, it
doesn't shift at all.
Best regards,
Khanh. 

-----Original Message-----
From: Sergey Bondarenko [mailto:enterit@gmail.com] 
Sent: Tuesday, March 13, 2007 3:46 PM
To: POI Developers List
Subject: Re: Deleting column

I've just looked at shiftRows(..). It is more intellectual than simple
setRowNum(..) for all rows. But maybe it's enough for you to call
cell.setCellNum(..) for all cells at the left from removed cell.
Is it suitable for you ?

Best regards,
Sergey.

2007/3/13, Khanh Tran <tr...@gmail.com>:
> Sorry for posting twice a question.
> I delete/insert rows fine now. After deleting/inserting, I called 
> shiftRows to shift the affected rows. I am looking for the similar 
> method for column, ie, shiftCells...
> Best regards,
> Khanh
>
> -----Original Message-----
> From: Sergey Bondarenko [mailto:enterit@gmail.com]
> Sent: Tuesday, March 13, 2007 3:02 PM
> To: POI Developers List
> Subject: Re: Deleting column
>
> You right, it deletes row, but it does not shift other rows up.
> You can then shift them up by yourself using HSSFRow.setRowNum(int
> rowNum) for each row below removed.
>
> Best regards,
> Sergey Bondarenko.
>
> 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > It just clean the row, not delete. When a row is deleted, all the 
> > following rows will be shift up.
> >
> > -----Original Message-----
> > From: Sergey Bondarenko [mailto:enterit@gmail.com]
> > Sent: Monday, March 12, 2007 6:23 PM
> > To: POI Developers List
> > Subject: Re: Deleting column
> >
> > Hi!
> >
> > I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.
> >
> > Best regards,
> > Sergey Bondarenko.
> >
> > 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > > Dear experts,
> > > Is there any way to delete a column/row in Excel file using POI?
> > >
> > > Thanks.
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> > >
> > >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Re: Deleting column

Posted by Sergey Bondarenko <en...@gmail.com>.
I've just looked at shiftRows(..). It is more intellectual than simple
setRowNum(..) for all rows. But maybe it's enough for you to
call cell.setCellNum(..) for all cells at the left from removed cell.
Is it suitable for you ?

Best regards,
Sergey.

2007/3/13, Khanh Tran <tr...@gmail.com>:
> Sorry for posting twice a question.
> I delete/insert rows fine now. After deleting/inserting, I called shiftRows
> to shift the affected rows. I am looking for the similar method for column,
> ie, shiftCells...
> Best regards,
> Khanh
>
> -----Original Message-----
> From: Sergey Bondarenko [mailto:enterit@gmail.com]
> Sent: Tuesday, March 13, 2007 3:02 PM
> To: POI Developers List
> Subject: Re: Deleting column
>
> You right, it deletes row, but it does not shift other rows up.
> You can then shift them up by yourself using HSSFRow.setRowNum(int
> rowNum) for each row below removed.
>
> Best regards,
> Sergey Bondarenko.
>
> 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > It just clean the row, not delete. When a row is deleted, all the
> > following rows will be shift up.
> >
> > -----Original Message-----
> > From: Sergey Bondarenko [mailto:enterit@gmail.com]
> > Sent: Monday, March 12, 2007 6:23 PM
> > To: POI Developers List
> > Subject: Re: Deleting column
> >
> > Hi!
> >
> > I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.
> >
> > Best regards,
> > Sergey Bondarenko.
> >
> > 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > > Dear experts,
> > > Is there any way to delete a column/row in Excel file using POI?
> > >
> > > Thanks.
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Re: Deleting column

Posted by Sergey Bondarenko <en...@gmail.com>.
And you can use shiftRows method of HSSFSheet, as you wrote in your
another letter :)


2007/3/13, Sergey Bondarenko <en...@gmail.com>:
> You right, it deletes row, but it does not shift other rows up.
> You can then shift them up by yourself using HSSFRow.setRowNum(int
> rowNum) for each row below removed.
>
> Best regards,
> Sergey Bondarenko.
>
> 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > It just clean the row, not delete. When a row is deleted, all the following
> > rows will be shift up.
> >
> > -----Original Message-----
> > From: Sergey Bondarenko [mailto:enterit@gmail.com]
> > Sent: Monday, March 12, 2007 6:23 PM
> > To: POI Developers List
> > Subject: Re: Deleting column
> >
> > Hi!
> >
> > I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.
> >
> > Best regards,
> > Sergey Bondarenko.
> >
> > 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > > Dear experts,
> > > Is there any way to delete a column/row in Excel file using POI?
> > >
> > > Thanks.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


RE: Deleting column

Posted by Khanh Tran <tr...@gmail.com>.
Sorry for posting twice a question. 
I delete/insert rows fine now. After deleting/inserting, I called shiftRows
to shift the affected rows. I am looking for the similar method for column,
ie, shiftCells...
Best regards,
Khanh

-----Original Message-----
From: Sergey Bondarenko [mailto:enterit@gmail.com] 
Sent: Tuesday, March 13, 2007 3:02 PM
To: POI Developers List
Subject: Re: Deleting column

You right, it deletes row, but it does not shift other rows up.
You can then shift them up by yourself using HSSFRow.setRowNum(int
rowNum) for each row below removed.

Best regards,
Sergey Bondarenko.

2007/3/12, Khanh Tran <tr...@gmail.com>:
> It just clean the row, not delete. When a row is deleted, all the 
> following rows will be shift up.
>
> -----Original Message-----
> From: Sergey Bondarenko [mailto:enterit@gmail.com]
> Sent: Monday, March 12, 2007 6:23 PM
> To: POI Developers List
> Subject: Re: Deleting column
>
> Hi!
>
> I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.
>
> Best regards,
> Sergey Bondarenko.
>
> 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > Dear experts,
> > Is there any way to delete a column/row in Excel file using POI?
> >
> > Thanks.
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Re: Deleting column

Posted by Sergey Bondarenko <en...@gmail.com>.
You right, it deletes row, but it does not shift other rows up.
You can then shift them up by yourself using HSSFRow.setRowNum(int
rowNum) for each row below removed.

Best regards,
Sergey Bondarenko.

2007/3/12, Khanh Tran <tr...@gmail.com>:
> It just clean the row, not delete. When a row is deleted, all the following
> rows will be shift up.
>
> -----Original Message-----
> From: Sergey Bondarenko [mailto:enterit@gmail.com]
> Sent: Monday, March 12, 2007 6:23 PM
> To: POI Developers List
> Subject: Re: Deleting column
>
> Hi!
>
> I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.
>
> Best regards,
> Sergey Bondarenko.
>
> 2007/3/12, Khanh Tran <tr...@gmail.com>:
> > Dear experts,
> > Is there any way to delete a column/row in Excel file using POI?
> >
> > Thanks.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


RE: Deleting column

Posted by Khanh Tran <tr...@gmail.com>.
It just clean the row, not delete. When a row is deleted, all the following
rows will be shift up. 

-----Original Message-----
From: Sergey Bondarenko [mailto:enterit@gmail.com] 
Sent: Monday, March 12, 2007 6:23 PM
To: POI Developers List
Subject: Re: Deleting column

Hi!

I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.

Best regards,
Sergey Bondarenko.

2007/3/12, Khanh Tran <tr...@gmail.com>:
> Dear experts,
> Is there any way to delete a column/row in Excel file using POI?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Re: Deleting column

Posted by Sergey Bondarenko <en...@gmail.com>.
Hi!

I think you can use HSSFSheet.removeRow(HSSFRow row) for rows removing.

Best regards,
Sergey Bondarenko.

2007/3/12, Khanh Tran <tr...@gmail.com>:
> Dear experts,
> Is there any way to delete a column/row in Excel file using POI?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/