简体   繁体   English

如何使用JXL从Excel中删除行

[英]How to delete a row from an excel using JXL

I am new to JXL and have worked on read and write of Excel files. 我是JXL的新手,并且从事读写Excel文件的工作。 But I could not find a function which would delete a row after I successfully read that row and move to the next. 但是在成功读取该行并移至下一行后,我找不到能删除该行的函数。

Code logic: If(readrow() == true) { deleteRow(); 代码逻辑:If(readrow()== true){deleteRow(); } }

Is there any example available? 有没有可用的例子? If there is no delete function can I copy the row to a new sheet and after all the rows are complete I would rename this sheet as the old sheet and remove the old sheet? 如果没有删除功能,我可以将该行复制到新工作表中,并且在所有行完成之后我可以将该工作表重命名为旧工作表并删除旧工作表吗? Thanks 谢谢

JXL does have a delete/remove row function... check this link for help JXL确实具有删除/删除行功能...请查看此链接以获得帮助

for(int i=0;i<count;i++){

if(doneWithRow){
sheet.removeRow(i);
}
}

the code example is not much but should get you started. 该代码示例并不多,但是应该可以帮助您入门。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM