使用apache POI将新列插入到现有excel文件之间 [英] Insert a new column in between to an existing excel file using apache POI

查看:114
本文介绍了使用apache POI将新列插入到现有excel文件之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Excel文件,该文件有2列.我想使用Java程序在现有的第一和第二之间添加一个新列.我正在尝试为此目的使用Apache POI.我遍历了api文档和一些相关的堆栈问题,但我可以找到仅删除/更新单元格(而不插入整个列)的示例.

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).

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

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

推荐答案

我找到了一个解决方案

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.

这篇关于使用apache POI将新列插入到现有excel文件之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆