标签:etc tco 数据 close sheet ring auth str http
什么是DTO,为什么要DTO?
数据传输对象,简单的来说就是用户在数据库的操作中涉及到了多表的属性,pojo中单独的类不能作为传输对象。因为他只对应了操作中的一部分属性,比如有学生表(姓名,学号,班级号)班级表(班级号,班级名)。当你查询某学生的班级名时,单独的学生类和班级类都不足以代表他们。因此就需要我们的dto,dto当你需要什么属性你就定义什么属性,仅作为一个传输对象。
JXL的用法workbook
可写表格与只读表格
读取exce
import java.io.File; import jxl.Cell; import jxl.Hyperlink; import jxl.Sheet; import jxl.Workbook; /** * 读取excel * @author Administrator * */ public class Test { public static void main(String[] args) throws Exception { Workbook book = Workbook.getWorkbook(new File("aa.xls")); Sheet sheet = book.getSheet("first"); int rows = sheet.getRows(); int cols = sheet.getColumns(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { System.out.print(sheet.getCell(j, i).getContents()+"\t"); } System.out.println(); } Cell cell = sheet.getCell(0, 0); Hyperlink[] links = sheet.getHyperlinks(); System.out.println(links.length); for (int i = 0; i < links.length; i++) { System.out.println(links[i].getURL().toString()); } } }
写入excel
package cn.zkingsoft; import java.io.File; import java.net.URL; import jxl.Workbook; import jxl.write.Label; import jxl.write.Number; import jxl.write.WritableHyperlink; import jxl.write.WritableImage; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; /** * 写入excel * @author Administrator * */ public class Test2 { public static void main(String[] args) throws Exception{ WritableWorkbook book = Workbook.createWorkbook(new File("classmate.xls")); WritableSheet sheet = book.createSheet("0913A", 0); sheet.addCell(new Label(0,0,"黄传名")); sheet.addCell(new Label(0,1,"45.89")); sheet.addCell(new Number(1,1,45.89d)); sheet.addImage(new WritableImage(2,2,5,10,new File("_logo_8.png"))); sheet.addHyperlink(new WritableHyperlink(0,3,new URL("https://www.baidu.com"))); book.write(); book.close(); } }
标签:etc tco 数据 close sheet ring auth str http
原文地址:https://www.cnblogs.com/zwz-bk/p/9992545.html