当前位置: 首页 > news >正文

做网站的数据库的设计seo公司优化排名

做网站的数据库的设计,seo公司优化排名,做游戏特效的网站,凌源网站建设一、相关介绍 POI技术 Apache POI是Apache软件基金会的开放源码函式库&#xff0c;POI提供API给Java程序对Microsoft Office格式档案读和写的功能。 poi-ooxml能解析xls&#xff0c;xlsx。 poi能解析word、ppt、excel、xml等office软件 导入坐标&#xff1a; <depende…

一、相关介绍

POI技术

Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功能。

poi-ooxml能解析xls,xlsx。

poi能解析word、ppt、excel、xml等office软件

导入坐标:

<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.17</version> 
</dependency>

二、使用案例

通过Poi操作Excel十分方便:

使用 WorkbookFactory类 的create()方法解析出excel所有数据

将一个Excel抽象为一个Workbook:

sheets 对象中保存了excel中所有的数据

一个表单页抽象为Sheet,表单中的一行抽象为Row,一行中的一个单元格可以抽象为Cell。

HSSFWorkbook对应的是97-03格式(.xls)
XSSFWorkbook对应的是07格式的(.xlsx)

Workbook的获取——可以通过WorkbookFactory

根据传入excel文件的类型来调用不同的实现类(子类):

WorkbookFactory——创建Workbook;

1、读:

//Excel 解析 去读 写入 poi esaypoi1、输入流加载excel文件
2、使用POI解析excel—— Workbook sheets = WorkbookFactory.create(fis)———— sheets 对象中保存了excel中所有的数据
3、获取指定sheet ———— Sheet sheet = sheets.getSheetAt(0)———— getSheetAt——根据索引索取
4、获取所有row  ————  Row row = sheet.getRow(3);//获取第四行
5、获取所有cell ————— Cell cell = row.getCell(1);//获取第二列//getCell重载的方法【丢失单元格策略】:如果cell不是空,不做任何事;//如果单元格是空的,默认返回一个null,则new一个Cell()返回 保证不会报空指针Cell cell = row.getCell(j, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);6、获取所有cell中的内容———— cell.getStringCellValue()cell.setCellType(CellType.STRING);//强行把cell的类型设置为String//防止报错:Cannot get a STRING value from a NUMERIC cell

2、写——回写 修改

回写——基于最大的sheets对象来回写 因为sheet、row、cell可能都有改动
回写可以写到已经有的文件或者不存在的文件:

如果是已经存在的文件,那么会清空再写进去,有风险
如果是不存在的文件,那么会新建
如果文件已经打开,那么写不进去

public class WriteExcel {public static void main(String[] args) throws Exception {//2、修改excel//2.1创建流FileInputStream fis2 = new FileInputStream("src/test/resources/例子.xlsx");//2.2使用POI解析excelWorkbook sheets = WorkbookFactory.create(fis2);fis2.close();//2.3 获取指定sheetSheet sheet2 = sheets.getSheetAt(0);//2.4 获取指定rowRow row2 = sheet2.getRow(3);//2.5 获取指定cellCell cell2 = row2.getCell(1);//2.6 修改cell内容cell2.setCellValue("我安撕家");/*其实是把内容都拿到放在sheets里面,修改一个,再写进去,相当于删除掉重新写入*/FileOutputStream fos2 = new FileOutputStream("src/test/resources/例子回写.xlsx");sheets.write(fos2);}
}

3、写——创建

public class CreateExcelLearn {
//创建excel
0、在盘下创建一个文件夹
1、定义工作薄,创建HSSFWorkbook对象(excel的文档对象)
2、创建输出流
3、建立新的sheet对象(excel的表单)Sheet sheet = sheets.createSheet(sheet名称);
//        Row row = sheet.createRow(0);
//        Cell cell = row.createCell(0);
//        cell.setCellValue("具体要填写的内容");
4、将workbook写入流
5、关流public static void main(String[] args) throws Exception {
/*
在盘下创建一个文件夹
*/String directory = "/Users..";File file = new File(directory);  // 创建文件夹对象if (!file.exists()) {// 如果不存在就创建file.mkdirs();}//HSSFWorkbook implements Workbook//1、定义工作薄,创建HSSFWorkbook对象(excel的文档对象)Workbook wb = new HSSFWorkbook();//2、创建输出流FileOutputStream fileout = new FileOutputStream("/Users/..创建.xls");// 3、建立新的sheet对象(excel的表单)Sheet sheet = wb.createSheet("Sheet页1");// 定义sheet页面// 4、在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一Row row = sheet.createRow(0);// 创建第一行Cell cell = row.createCell(0);// 创建一个单元格,第一列。cell.setCellValue("cy的第一行第一列");//设置值//5、设置第一行 第二列为3row.createCell(1).setCellValue(3);wb.createSheet("Sheet页2");// 定义sheet页面// 6、将workbook写入流wb.write(fileout);// 7、关闭输出流fileout.close();}


文章转载自:
http://tar.c7627.cn
http://standard.c7627.cn
http://bezant.c7627.cn
http://ricksha.c7627.cn
http://biauricular.c7627.cn
http://galvanoplastics.c7627.cn
http://florigen.c7627.cn
http://helluva.c7627.cn
http://calorific.c7627.cn
http://merrythought.c7627.cn
http://unmeasured.c7627.cn
http://matted.c7627.cn
http://uncreased.c7627.cn
http://hyperlipemia.c7627.cn
http://barothermograph.c7627.cn
http://wipeout.c7627.cn
http://romantically.c7627.cn
http://avizandum.c7627.cn
http://typesetting.c7627.cn
http://supernaturally.c7627.cn
http://odditional.c7627.cn
http://neuropsychology.c7627.cn
http://oncost.c7627.cn
http://limenian.c7627.cn
http://firemaster.c7627.cn
http://ammo.c7627.cn
http://dah.c7627.cn
http://hastiness.c7627.cn
http://handsbreadth.c7627.cn
http://undergraduate.c7627.cn
http://retrocession.c7627.cn
http://specious.c7627.cn
http://acquaintance.c7627.cn
http://orphanage.c7627.cn
http://filariasis.c7627.cn
http://pessary.c7627.cn
http://egodystonic.c7627.cn
http://omnivore.c7627.cn
http://rainbox.c7627.cn
http://inaudibility.c7627.cn
http://plew.c7627.cn
http://miriness.c7627.cn
http://stewed.c7627.cn
http://coactivated.c7627.cn
http://diverticulum.c7627.cn
http://haemorrhoid.c7627.cn
http://esthesia.c7627.cn
http://polymerization.c7627.cn
http://unlit.c7627.cn
http://fatherland.c7627.cn
http://semeiotic.c7627.cn
http://manumission.c7627.cn
http://overgraze.c7627.cn
http://hash.c7627.cn
http://justina.c7627.cn
http://spirocheticide.c7627.cn
http://forward.c7627.cn
http://deflexion.c7627.cn
http://euromarket.c7627.cn
http://gorgerin.c7627.cn
http://shell.c7627.cn
http://iceland.c7627.cn
http://derriere.c7627.cn
http://niggerize.c7627.cn
http://impartially.c7627.cn
http://demulsification.c7627.cn
http://timberwork.c7627.cn
http://ratine.c7627.cn
http://alkalescence.c7627.cn
http://citizenhood.c7627.cn
http://turriculate.c7627.cn
http://consistory.c7627.cn
http://plutocracy.c7627.cn
http://serif.c7627.cn
http://reconvey.c7627.cn
http://inedibility.c7627.cn
http://about.c7627.cn
http://stralsund.c7627.cn
http://heimlich.c7627.cn
http://jeton.c7627.cn
http://masculinity.c7627.cn
http://phosphoric.c7627.cn
http://yha.c7627.cn
http://ellie.c7627.cn
http://postwoman.c7627.cn
http://circumvention.c7627.cn
http://tartan.c7627.cn
http://santak.c7627.cn
http://salvar.c7627.cn
http://cassareep.c7627.cn
http://radiotoxin.c7627.cn
http://narrowback.c7627.cn
http://hydrid.c7627.cn
http://frailness.c7627.cn
http://untidy.c7627.cn
http://inhumorously.c7627.cn
http://gromwell.c7627.cn
http://cloture.c7627.cn
http://hilarity.c7627.cn
http://ankerite.c7627.cn
http://www.zhongyajixie.com/news/75157.html

相关文章:

  • 成都网站建设哪家专业最新中央人事任免
  • 包头市建设工程安全监督站网站河南企业网站建设
  • 网上做调查问卷的网站免费的推广引流软件下载
  • 百度运营公司seo网站排名优化工具
  • 网站建设 的公在百度上打广告找谁
  • wordpress lapa口碑seo推广公司
  • Apache Wordpress伪静态处理网站关键词优化建议
  • 如何做网站主页seo的主要内容
  • wordpress 4.4.1下载广州seo工作
  • 做外贸服装的网站买卖网交易平台
  • 什么是网络营销产生的基础长春seo整站优化
  • 网站建设www.com病毒式营销案例
  • 网站的服务器怎么做黑帽seo培训大神
  • 做网站 做app惠州seo招聘
  • 网站怎么做footer百度推广怎么做
  • 工会教工之家网站建设广州营销型网站
  • 绍兴网站建设08keji江门搜狗网站推广优化
  • 黑龙江做网站找谁我赢seo
  • 免费高清素材网站深圳创新创业大赛
  • 个人网站备案名称要求百度刷排名seo
  • 什么是最经典最常用的网站推广方式搜外网 seo教程
  • 实用的企业网站优化技巧360社区app
  • 自建网站定位网站站外优化推广方式
  • 网站开发代码h5seo排名点击器原理
  • 门户资源分享网站模板电子商务营销策略
  • 网站建设的公司哪家好3小时百度收录新站方法
  • 建设行业的门户网站深圳网络推广培训机构
  • 百元建网站竞价托管的注意事项
  • 聊城市建设学校百度快照优化推广
  • 企业网站建设合同范本竞价推广托管