java - Apache POI xls column Remove -


I do not have a way to remove a column with Apache POI API.
I appreciate a sample code or help at this point.

written

  package org.alanwilliamson openbd.plugin.spreadsheet; Import org.apache.poi.ss.usermodel.Cell; Import org.apache.poi.ss.usermodel.Row; Import org.apache.poi.ss.usermodel.Sheet; / * * To provide help in the management of sheets, auxiliary work / public class sheets provide utility items. {/ ** * Given a sheet, this method removes a column from a sheet and runs all the columns on the left side of the right one note * * Note, this method will not update any formula reference. * * Ultimate Sheet * @ Ultimate Column * / Public Static Zero Delete Columns (Sheet Sheet, Int Column Toddler) {int maxColumn = 0; For (int r = 0; r & lt; sheet.getLastRowNum () + 1; r ++) {row row = sheet.getRow (r); // if no row exists; So do not do anything; the upcoming! If (line == zero) will continue; // If there are not many columns in the line then we are good; the upcoming! Int lastColumn = row.getLastCellNum (); If (last column & gt; Max. Column) maxColumn = lastColumn; If (the last column & lt; column totelete) will continue; For (int x = columnToDelete + 1; x & lt; last column + 1; x ++) {cell old cell = line.getlet (x-1); If (old cell! = Null) line Remote cell (old cell); Cell next cell = line.get cell (x); If (next cell! = Null) {cell nucleus = row.Careletel (x-1, next cell.gatecliptype); Cloncell (new call, next cell); }}} // Adjust the column width (int c = 0; c  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -