[quote=引用 6 楼 wzqhfy 的回复:] HSSFWorkbook wk = new HSSFWorkbook(); //创建一个名称为mySheet的表 ISheet tb = wk.CreateSheet("mySheet"); //创建一行,此行为第二行 int j = 0; string[] t = File.ReadAllLines("test.txt",Encoding.Default); ICell cell; foreach (string s in t) { j++; IRow row = tb.CreateRow(j); string[] scell=s.Split(' '); for (int i = 0; i < scell.Count(); i++) { string c = scell[i].ToString(); cell = row.CreateCell(i); cell.SetCellValue(c); } } using (FileStream fs = File.OpenWrite(@"d:\\myxls.xls")) { wk.Write(fs); MessageBox.Show("创建成功!"); }
HSSFWorkbook wk = new HSSFWorkbook(); //创建一个名称为mySheet的表 ISheet tb = wk.CreateSheet("mySheet"); //创建一行,此行为第二行 int j = 0; string[] t = File.ReadAllLines("test.txt",Encoding.Default); ICell cell; foreach (string s in t) { j++; IRow row = tb.CreateRow(j); string[] scell=s.Split(' '); for (int i = 0; i < scell.Count(); i++) { string c = scell[i].ToString(); cell = row.CreateCell(i); cell.SetCellValue(c); } } using (FileStream fs = File.OpenWrite(@"d:\\myxls.xls")) { wk.Write(fs); MessageBox.Show("创建成功!"); }
先贴出你们的上位机、ERP等的技术设计来。
110,533
社区成员
642,574
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧