带宏函数等excel解析方法
来源:互联网 发布:excel表xy轴怎么填数据 编辑:程序博客网 时间:2024/04/18 13:37
不能正常解析的excel需转换,下面是我写的例子,直接贴代码
//输入 和输入都是文件夹
public static void excelTo2003V(String excFilePath,String outFilePath,String endStr){File[] files=readFilePath(excFilePath);//获得所有输入文件
for(int i=0;i<files.length;i++){
if(files[i].isFile()&&files[i].getPath().endsWith(endStr)){//获得所有xlsm文件
// 1.word文档转html文件
String htmlPath= Word2Html.excelToHtml(files[i].getPath());//excel转html
//2读取html。files文件夹
String htmlFiles=htmlPath.substring(0, htmlPath.indexOf("."))+".files";
System.out.println(htmlFiles);
File[] htmlFileChilds=readFilePath(htmlFiles);
List<List<List<String>>> allSheet=new ArrayList<List<List<String>>>();//单个文件读取在写入xls会覆盖
System.out.println("================开始解析================");
for(int j=0;j<htmlFileChilds.length;j++){
if(htmlFileChilds[j].isFile()&&htmlFileChilds[j].getPath().endsWith("htm")){//满足要求 开始解析
List<List<String>> results= parseHtml(htmlFileChilds[j].getPath());//获得当前页面数据
allSheet.add(results);
}
}
System.out.println("================解析完成-开始写入================");
String outStreamFile=outFilePath+"/"+htmlFiles.substring(htmlFiles.lastIndexOf("\\")+1,htmlFiles.lastIndexOf("."))+"-reslut.xls";
try {
poiExportToExcel2003(allSheet, outStreamFile );
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("================写入完毕================");
}
}
}
public static void main(String[] args) {
// String htmlFiles="D:\\pdfReader\\BI0901-1 中国银行利率敏感性状况历史变动表.files\\sheet002.htm";
// String excFilePath="D:/pdfReader/BI0901-1 中国银行利率敏感性状况历史变动表.xlsm";
// Excel2HtmlParse.parseHtml(htmlPath);
String outFilePath="D:\\pdfReader\\reslut";//批量分析文件夹
String htmlFiles="D:\\pdfReader\\reslut";//导出文件夹
String endStr="xlsm";//批量分析文件 类型
// System.out.println( outFilePath+"/"+htmlFiles.substring(htmlFiles.lastIndexOf("\\")+1,htmlFiles.lastIndexOf("."))+".xls");
excelTo2003V(htmlFiles,outFilePath,endStr);
}
对于不不能正常解析的excel文件需要把错误的,2007带函数命令的转成2003版的excel文件
0 0
- 带宏函数等excel解析方法
- android解析word,excel等文件的方法
- EXCEL宏常用的函数等
- Excel函数、快捷键等
- java解析excel方法
- Android中解析读取复杂word,excel,ppt等的方法
- Android中解析读取复杂word,excel,ppt等的方法
- java poi解析excel,带合并单元的excel
- java 解析excel,带合并单元的excel
- 运行带宏的excel
- [python]带参数的装饰函数解析
- 函数、方法等中的const?
- iOS 自带方法解析json
- json解析之自带方法
- PHP解析带CDATA的XML方法
- UltraWebGrid手写导出excel方法(非自带控件方法)
- java解析Excel文件的方法
- java解析并且操作excel 方法
- VMware中CentOS设置静态IP
- 浅谈算法和数据结构: 十一 哈希表
- 龙珠直播CTO谭振林:从0到500万用户背后的技术架构变迁
- 关于scrolleView 的[MTMeViewController scrollViewDidScroll:]: message sent to deallocated instance 0x7fc
- android中handler用法总结
- 带宏函数等excel解析方法
- c#.net网页跳转七种方法
- 分享一种最简单的Android打渠道包的方法
- LintCode:把排序数组转换为高度最小的二叉搜索树
- iOS GitHub上值得留意的第三方库
- 分布式搜索Elasticsearch——概述
- 设置启动图片
- LeetCode 26:Remove Duplicates from Sorted Array
- iOS之自定义弹出框--AlertView