资源简介
本来以为通过Microsoft.Office.Interop.Excel来操作Excel的速度已经是很不理想,所以找到了OpenXml,本以为通过这种方式来操作速度应该提升很多吧,谁知试了一下那速度真是相当的慢~~~我分别用两种方式些1000*26个单元格的数据,OpenXml居然10分了都还没写完,而普通的操作1分钟内就可以搞定了~~~不知道是我代码的问题,还是OpenXml本身的效率问题,还请大家在下载资源后帮我看一看~~~~~~

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.Openxml;
using DocumentFormat.Openxml.Packaging;
using DocumentFormat.Openxml.Spreadsheet;
using System.Text.Regularexpressions;
using Excel = Microsoft.Office.Interop.Excel;
namespace OpenxmlTest
{
class Program
{
public static void UseCommom()
{
Excel.Application excelApp = new Excel.Application();
Excel.Workbook expWorkBookConfig = null;//EXCEL 产品配置文件 (中文)
Excel.Workbooks expWorkBooks = null;
//打开Excle文件 创建表格对象
excelApp.Visible = false; excelApp.DisplayAlerts = false;
try
{
expWorkBooks = excelApp.Workbooks;
expWorkBookConfig = expWorkBooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
Excel.Worksheet sheet = expWorkBookConfig.Worksheets[1];
for (int iLine = 1; iLine < 200; iLine++)
{
for (char ch = ‘A‘; ch <= ‘Z‘; ch++)
{
string str = string.Format(“{0}“ ch);
Excel.Range ACell = sheet.get_Range(str + iLine.ToString() System.Reflection.Missing.Value);
ACell.Value2 = “TestTestTestTestTestTestTestTestTestTestTestTestTestTestTest“;
}
}
expWorkBookConfig.SaveAs(@“D:\03.Code\03.New_Project\TestProject\OpenxmlTest\OpenxmlTest\bin\Release\Commom.xlsx“
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value
System.Reflection.Missing.Value);
expWorkBookConfig.Close();
excelApp.Quit();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
excelApp.Quit();
expWorkBookConfig = null;
excelApp = null;
}
GC.Collect();
}
public static void UseOpenxml()
{
TLExcel doc = new TLExcel();
if (TLExcel.TLOK == doc.Create(“Openxml.xlsx“))
{
Console.WriteLine(“开始时间:“ + DateTime.Now);
for (int iLine = 1; iLine < 200; iLine++)
{
for (char ch = ‘A‘; ch <= ‘Z‘; ch++)
{
string str = string.Format(“{0}“ ch);
doc.WriteCellV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3690 2012-03-27 10:48 Program.cs
文件 14006 2012-03-27 09:50 TLExcel.cs
----------- --------- ---------- ----- ----
17696 2
相关资源
- 先进先出库存管理excel表格.rar
- [免费]强大的OFFICE经验(Word Excel)
- ICD10 excel
-
分别适用于.NET fr
amework 2.0和4.0的E - K码和经纬度转换excel表格
- Php 导出数据为EXCEL程序
- 项目周报格式(excel格式报表)
- 一个基于MFC的GridCtrl,提供类似Excel的
- EXCEL横转竖(列转行)宏
- Excel高效办公实例
- 湖南省计算机等级二级考试excel题集锦
- EXCEL文件转换成固定的格式的文本格式
- 从EXCEL中取数据在Teechart7显示应用示例
- excel VBA 800(全)
- 易语言Excel多表对应处理源码
- 易语言EXCEL另存为CSV文件源码
- EXCEL函数手册.chm格式
- Excel修复精灵中文免费版2009
- DataNumen Excel Repair Excel文件修复工具
- vue实现导出Excel的两个js文件-Blob+Exp
- Blob.js+Export2Excel.js
- LibXL for Windows 3.8.3 最新版Excel操作库带
- EXCEL 甘特图模板
- 项目开发计划与跟踪汇总表模板
- 中文版excel2007 图表宝典(光盘附件)
- 嵌入式工程师周报 项目管理 甘特图
- Ubuntu下操作Excel,qt代码
- Labwindows/CVI下Excel打开、读写操作
- 易语言导入EXCEL到EDB数据库源码
- 汉字转拼音或首字母小工具 Excel方便
评论
共有 条评论