开发者

Copy and paste rows with HSSF (Apache POI) [duplicate]

开发者 https://www.devze.com 2023-02-26 11:36 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: How to insert a row between two rows in an existing excel with HSSF (Apache POI)
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

How to insert a row between two rows in an existing excel with HSSF (Apache POI)

How can I copy the values and all the formatting of a row using HSSF. Using the MS Excel or other Spread Sheet application it is easy as copy and paste. But now I'm having problem copying a row with HSSF in Java.

My scenario right now, is I'm on the Cell:A46开发者_运维问答 and it is the last row of the table, but I still have many data to populate on the cell. I cannot simply just create a row and it cells, because I need also the formatting. And it may also break some of the formulas, because I use an excel template which have formatting after Cell:A46.


Why do you not iterate trough the cells, and creating a new cell on the new row and copy the layout information from the "old" one?


BTW: If you have to do with may style information, then have a look at JXLS. It is based on POI and an be used (for example) to populate Excel files, from Excel-file based templates


I did a similar post that have an answer which solve this problem.

For the answer, just take a look on my other post here

0

精彩评论

暂无评论...
验证码 换一张
取 消