读excel
来源:互联网 发布:软件销售是什么职位 编辑:程序博客网 时间:2024/06/04 23:58
之前没想到写个程序转换下,手动写了大约1个多小时,还有很多没写完,实在是写不下去才。。。。。。
之前怕写程序浪费时间,没想到手写更浪费时间,写程序才花一个多小时就全部搞定了,
似乎像这种重复的工作最好是用程序完成,吸取教训。。。。。。
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class create {
public static void main(String[] args) {
File f = new File("f://企業間詳細スケジュール.xls");
Workbook wb;
try {
wb = Workbook.getWorkbook(f);
Sheet s = wb.getSheet("Sheet2");
createNodes(s);
//createCase(s);
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void createCase(Sheet s){
int row = s.getRows();
String outputNodes="";
String menuMn = "興人 再変換起動";
String menuId = s.getCell(11, 0).getContents();
outputNodes += "case /"" + menuMn + "/":/n"
+ " open_window(/"" + menuId + "Form/", /"MP.Kikan.Edi." + menuId.substring(0,6)
+ "/", /"MP.Kikan.Edi." + menuId.substring(0,6) + "." + menuId + ".WinUI." + menuId + "Form/");/n" + " break;/n";
for (int i = 1; i < row; i++) {
if(!"1".equals(s.getCell(5, i).getContents())){
i++;
continue;
}
if(!menuMn.equals(s.getCell(11, i).getContents())){
menuId = s.getCell(11, i).getContents();
menuMn = s.getCell(4, i).getContents();
outputNodes += "case /"" + menuMn + "/":/n"
+ " open_window(/"" + menuId + "Form/", /"MP.Kikan.Edi." + menuId.substring(0,6)
+ "/", /"MP.Kikan.Edi." + menuId.substring(0,6) + "." + menuId + ".WinUI." + menuId + "Form/");/n" + " break;/n";
}
i++;
}
System.out.println(outputNodes);
}
public static void createNodes(Sheet s){
String rank1 = "興人";
String rank2 = "興人 再変換";
String rank3 = "興人 再変換起動";
String outputNodes="";
outputNodes += "this.trvMenu.Nodes[3].Nodes.Add(/"" + rank1 + "/");/n";
outputNodes += "this.trvMenu.Nodes[3].Nodes[" + 0 +"].Nodes.Add(/"" + rank2 + "/");/n";
int row = s.getRows();
int j = 0;
int k = -1;
int l = 0;
for (int i = 1; i < row; i++) {
if(!"1".equals(s.getCell(5, i).getContents())){
i++;
continue;
}
if(!rank1.equals(s.getCell(0, i).getContents())){
rank1 = s.getCell(0, i).getContents();
outputNodes += "this.trvMenu.Nodes[3].Nodes.Add(/"" + rank1 + "/");/n";
j++;
k = -1;
}
if(!rank2.equals(s.getCell(2, i).getContents())){
rank2 = s.getCell(2, i).getContents();
outputNodes += "this.trvMenu.Nodes[3].Nodes[" + j +"].Nodes.Add(/"" + rank2 + "/");/n";
k++;
l = 0;
}
rank3 = s.getCell(4, i).getContents();
if(k==-1) k=0;
outputNodes += "this.trvMenu.Nodes[3].Nodes["+ j +"].Nodes[" + k + "].Nodes.Add(/""+ rank3+"/");/n";
outputNodes += "this.trvMenu.Nodes[3].Nodes["+ j +"].Nodes[" + k + "].Nodes[" + l + "].NodeFont = DISABLE_ITEM_FONT;/n";
outputNodes += "this.trvMenu.Nodes[3].Nodes["+ j +"].Nodes[" + k + "].Nodes[" + l + "].ForeColor = Color.Blue;/n";
i++;
l++;
}
System.out.println(outputNodes);
}
}
- 读excel
- EXCEL读
- AE读excel及输出excel表
- 读Excel:Reading excel in a ListBox
- win7 excel DCOM配置 / 远程读excel
- java 读Excel文档
- poi读excel文件
- Python 读Excel
- 读excel文件
- SQL 读 EXCEL文档
- 读Excel文件
- 读Excel到DataTable
- python读excel示例
- 读excel(一)
- c# 读excel
- java 读excel 实例
- C#读一行EXCEL
- java 读excel
- 去掉"该网站可能含有恶意软件,有可能会危害您的电脑" google 提示
- 跟我从头学WSH(1)--脚本编写
- (利用键值对)java中打印集合中字符出现次数
- 人生如水
- 感性营销:管理客户生命周期的有效工具
- 读excel
- web.config文件详解 (转)
- 分拆列值
- 求最大公约数
- **web.config**页面传参部分乱码,通过修改webconfig 解决问题
- 控制输入框只能输数字
- 跟我从头学WSH(2) --Object
- XQuery基础知识
- 如何获得决定你在IT行业发展高度的软技能