开发者

How to delete a row from an Existing Excel Sheet using JXL

开发者 https://www.devze.com 2023-03-24 08:14 出处:网络
I am not able to delete row of an existing excel sheet using JXL. Are开发者_JAVA百科 there any other way to delete a row from and existing workbook?for (int i = endLine -1 ; i >= startLine -1 ; i--

I am not able to delete row of an existing excel sheet using JXL.

Are开发者_JAVA百科 there any other way to delete a row from and existing workbook?


for (int i = endLine -1 ; i >= startLine -1 ; i--) { wSheet.removeRow(i);}

Remember that the JXL will elevate all the following lines when this line is deleted, so try to delete lines backwards in order to avoid the alternative deletion.


Try this:

 WritableWorkbook wb = Workbook.createWorkbook(new   File("output.xls"));
   WritableSheet sheet = wb.getSheet("some sheet");

   //delete row 10

   sheet.removeRow(10);
0

精彩评论

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