91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-11
  • 語言: 其他
  • 標簽: OpenXml??Excel??

資源簡介

本來以為通過Microsoft.Office.Interop.Excel來操作Excel的速度已經(jīng)是很不理想,所以找到了OpenXml,本以為通過這種方式來操作速度應(yīng)該提升很多吧,誰知試了一下那速度真是相當?shù)穆齸~~我分別用兩種方式些1000*26個單元格的數(shù)據(jù),OpenXml居然10分了都還沒寫完,而普通的操作1分鐘內(nèi)就可以搞定了~~~不知道是我代碼的問題,還是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?產(chǎn)品配置文件?(中文)
????????????Excel.Workbooks?expWorkBooks?=?null;
????????????//打開Excle文件?創(chuàng)建表格對象
????????????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?????????????????{
????????????????????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?????????????????{
????????????????????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


評論

共有 條評論