You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Marko Asplund <ma...@kronodoc.com> on 2004/12/03 14:04:33 UTC

HSSF: inserting a new column in existing sheet

i'm trying to figure out how to insert a new column in the middle of 
existing columns with HSSF usermodel API for spreadsheets that have 
been created with MS Excel. HSSFRow.createCell() seems to insert a cell 
replacing the existing cell, so it can't be used in a similar fashion 
as you would with rows (HSSFSheet.shiftRows()). i was thinking about 
just creating a new cell in the end of each row and then shifting 
(copying) the values of existing cells to the left. on second thought 
this does not seem to work when there're formula cells in the existing 
sheet (HSSFCell.setCellType() not supported for formulas according to 
documentation). also, does HSSF support all types of cells that can be 
created by MS Excel?

how would other people solve this insertion problem?

best regards,
--
	aspa


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


Re: HSSF: inserting a new column in existing sheet

Posted by Marko Asplund <ma...@kronodoc.com>.
On 06 Dec, 2004, at 19:44, Danny Mui wrote:

> maybe copy the shiftrows logic as a shiftcolumns?  shiftrows renumbers 
> formulas and such based on row number, so doing the same to columns 
> shouldn't be that much of a bother.
>
> grab the source and give it a shot!
>
> or post a bugzilla enhancement request and vote for it.

created an enhancements request for this:

http://issues.apache.org/bugzilla/show_bug.cgi?id=32562


best regards,
--
	aspa


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


Re: HSSF: inserting a new column in existing sheet

Posted by Danny Mui <da...@muibros.com>.
maybe copy the shiftrows logic as a shiftcolumns?  shiftrows renumbers 
formulas and such based on row number, so doing the same to columns 
shouldn't be that much of a bother.

grab the source and give it a shot!

or post a bugzilla enhancement request and vote for it.

Marko Asplund wrote:
> 
> i'm trying to figure out how to insert a new column in the middle of 
> existing columns with HSSF usermodel API for spreadsheets that have been 
> created with MS Excel. HSSFRow.createCell() seems to insert a cell 
> replacing the existing cell, so it can't be used in a similar fashion as 
> you would with rows (HSSFSheet.shiftRows()). i was thinking about just 
> creating a new cell in the end of each row and then shifting (copying) 
> the values of existing cells to the left. on second thought this does 
> not seem to work when there're formula cells in the existing sheet 
> (HSSFCell.setCellType() not supported for formulas according to 
> documentation). also, does HSSF support all types of cells that can be 
> created by MS Excel?
> 
> how would other people solve this insertion problem?
> 
> best regards,
> -- 
>     aspa
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org

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