使用apache POI在其间插入新列到现有excel文件

时间:2022-03-25 16:37:33

I have an excel file which have 2 columns. I want to add a new column in between existing first and second using java program. I am trying to use Apache POI for this purpose. I went through the api docs and some of the related stack over flow questions but I could find examples which only delete/update the cells(not inserting an entire column).

我有一个excel文件,有2列。我想在使用java程序的现有第一个和第二个之间添加一个新列。我正在尝试将Apache POI用于此目的。我浏览了api文档和一些相关的堆栈流程问题,但我可以找到只删除/更新单元格的示例(不插入整个列)。

Can any one share useful pointer to this? The only solution which I can think as if now is create a new sheet with 3 columns copy 1st column and 3rd column value from old

任何人都可以共享有用的指针吗?我现在可以想到的唯一解决方案是创建一个包含3列的新工作表,复制旧的第1列和第3列值

1 个解决方案

#1


0  

I found a solution https://github.com/bit-twit/poi-shift-column/blob/master/src/main/java/org/bittwit/poi/ExcelOpener.java. It's working fine.

我找到了一个解决方案https://github.com/bit-twit/poi-shift-column/blob/master/src/main/java/org/bittwit/poi/ExcelOpener.java。它工作正常。

#1


0  

I found a solution https://github.com/bit-twit/poi-shift-column/blob/master/src/main/java/org/bittwit/poi/ExcelOpener.java. It's working fine.

我找到了一个解决方案https://github.com/bit-twit/poi-shift-column/blob/master/src/main/java/org/bittwit/poi/ExcelOpener.java。它工作正常。