本文介绍如何使用spire.xls for java隐藏或显示excel中的网格线。
import com.spire.xls.excelversion;
import com.spire.xls.workbook;
import com.spire.xls.worksheet;
public class hideorshowgridlines {
public static void main(string[] args) {
//创建workbook对象
workbook workbook = new workbook();
//加载excel文档
workbook.loadfromfile("c:\\users\\administrator\\desktop\\sample.xlsx");
//获取第一个工作表
worksheet worksheet = workbook.getworksheets().get(0);
//隐藏网格线
worksheet.setgridlinesvisible(false);
////显示网格线
//worksheet.setgridlinesvisible(true);
//保存文档
workbook.savetofile("hidegridlines.xlsx", excelversion.version2016);
}
}
隐藏网格线