Apache POI xls column Remove

前端 未结 5 486
孤城傲影
孤城傲影 2020-12-17 17:47

I don\'t find how to remove a column with the Apache POI API.
I would appreciate a sample code or help on this point.

5条回答
  •  既然无缘
    2020-12-17 18:29

    There is a term confusion: the action that author author would like to achieve is called column shift it terms of Apache POI interface. org.apache.poi.ss.usermodel.Sheet interface provide a clean method to do such thing:

    sheet.shiftColumns(startRangeIndex, endRangeIndex, directionQuantifier);
    

    For instance, moving Column B to one position left is easily achievable by calling:

    Sheet sheet = loadRequiredSheet();
    sheet.shiftColumns(2, 3, -1);
    
    Column A        Column B                 Column C
    Data here    to be removed   <- t should be moved to the left
    

提交回复
热议问题