首页 [ 开发辅助 ] CSExcel实例(ExcelLibrary控件)源码
一键分享

CSExcel实例(ExcelLibrary控件)源码

  • 免费

2014-01-22 14:00:02

收藏 171 次|关注 3378 次|下载 605 次

免费


交付物: 源码包
    商家已实名认证
  • 分享者:xiaoh***
  • 访问次数:   38636 次
  • 源码数量:   297 套
  • 通过比率:   66%
  • 活跃于:   三个月前
  • TEL:   15*******45
  • 最新IP属地:北京市
  • 微信扫码咨询
.net

源码介绍

源码参数

  • 源码类别:【开发辅助】
  • 源码类型:C/S
  • 适合人群: 进阶
  • 授权类型:免费版
  • 开发语言:C#
  • 数据库:无数据库
  • 源码大小:290KB
  • 相关网址: 【免费浏览】
  • 源码指数:
  • 完整度:
  • 导入Excel
  • Excel浏览
  • 代码片段
  • 导入Excel
  • Excel浏览
  • 代码片段
  • Aspx.Query.CodeImageQueryModel
  • Aspx.Query.CodeImageQueryModel
  • Aspx.Query.CodeImageQueryModel

CSExcel实例(ExcelLibrary控件)源码

源码描述:
ExcelLibrary控件的目的是提供一个本地.net解决方案创建、读取和修改Excel文件不使用COM互操作或OLEDB连接。
目前实现了.xls(BIFF8)格式。
操作方法:
//create new xls file
string file = "C:\\newdoc.xls";
Workbook workbook = new Workbook();
Worksheet worksheet = new Worksheet("First Sheet");
worksheet.Cells[0, 1] = new Cell((short)1);
worksheet.Cells[2, 0] = new Cell(9999999);
worksheet.Cells[3, 3] = new Cell((decimal)3.45);
worksheet.Cells[2, 2] = new Cell("Text string");
worksheet.Cells[2, 4] = new Cell("Second string");
worksheet.Cells[4, 0] = new Cell(32764.5, "#,##0.00");
worksheet.Cells[5, 1] = new Cell(DateTime.Now, @"YYYY\-MM\-DD");
worksheet.Cells.ColumnWidth[0, 1] = 3000;
workbook.Worksheets.Add(worksheet);
workbook.Save(file);

// open xls file
Workbook book = Workbook.Load(file);
Worksheet sheet = book.Worksheets[0];

 // traverse cells
 foreach (Pair<Pair<int, int>, Cell> cell in sheet.Cells)
 {
     dgvCells[cell.Left.Right, cell.Left.Left].Value = cell.Right.Value;
 }
 
 // traverse rows by Index
 for (int rowIndex = sheet.Cells.FirstRowIndex; 
        rowIndex <= sheet.Cells.LastRowIndex; rowIndex++)
 {
     Row row = sheet.Cells.GetRow(rowIndex);
     for (int colIndex = row.FirstColIndex; 
        colIndex <= row.LastColIndex; colIndex++)
     {
         Cell cell = row.GetCell(colIndex);
     }
 }

责任编辑:xiao

下载记录(Only Recent 100)

用户名 推荐指数 下载时间

源码评论

单击更换

评论列表

全部评论
  • 暂无评论 …

最近更新

      下载排行