xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 23KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-14
  • 語(yǔ)言: C#
  • 標(biāo)簽: c#??EXCEL????

資源簡(jiǎn)介

c#調(diào)用EXCEL宏及操作類 c#調(diào)用EXCEL宏及操作類 c#調(diào)用EXCEL宏及操作類

資源截圖

代碼片段和文件信息

using?System;
using?System.IO;
using?System.Text;
using?System.Data;
using?System.Reflection;
using?System.Diagnostics;
using?System.Collections;

//using?cfg?=?System.Configuration;

namespace?GDBI.Common
{
///?
///?說(shuō)????明:Excel輸出打印模塊
/// ??暫時(shí)不提供操作Excel對(duì)象樣式方法,樣式可以在Excel模板中設(shè)置好
/// 作????者:lingyun_k
/// 創(chuàng)建日期:2005-7-12
///?

public?class?ExcelHelper
{
#region?成員變量
private?string?templetFile?=?null;
private?string?outputFile?=?null;
private?object?missing?=?Missing.Value;
private?DateTime?beforeTime; //Excel啟動(dòng)之前時(shí)間
private?DateTime?afterTime; //Excel啟動(dòng)之后時(shí)間
Excel.Application?app;
Excel.Workbook?workBook;
Excel.Worksheet?workSheet;
Excel.Range?range;
Excel.Range?range1;
Excel.Range?range2;
Excel.TextBox?textBox;
private?int?sheetCount?=?1; //WorkSheet數(shù)量
private?string?sheetPrefixName?=?“頁(yè)“;
#endregion

#region?公共屬性
///?
///?WorkSheet前綴名,比如:前綴名為“頁(yè)”,那么WorkSheet名稱依次為“頁(yè)-1,頁(yè)-2...”
///?

public?string?SheetPrefixName
{
set?{?this.sheetPrefixName?=?value;?}
}

///?
///?WorkSheet數(shù)量
///?

public?int?WorkSheetCount
{
get?{?return?workBook.Sheets.Count;?}
}

///?
///?Excel模板文件路徑
///?

public?string?TempletFilePath
{
set?{?this.templetFile?=?value;?}
}

///?
///?輸出Excel文件路徑
///?

public?string?OutputFilePath
{
set?{?this.outputFile?=?value;?}
}
#endregion

#region?公共方法

#region?ExcelHelper
///?
///?構(gòu)造函數(shù),將一個(gè)已有Excel工作簿作為模板,并指定輸出路徑
///?

///?Excel模板文件路徑
///?輸出Excel文件路徑
public?ExcelHelper(string?templetFilePathstring?outputFilePath)
{
if(templetFilePath?==?null)
throw?new?Exception(“Excel模板文件路徑不能為空!“);

if(outputFilePath?==?null)
throw?new?Exception(“輸出Excel文件路徑不能為空!“);

if(!File.Exists(templetFilePath))
throw?new?Exception(“指定路徑的Excel模板文件不存在!“);

this.templetFile?=?templetFilePath;
this.outputFile?=?outputFilePath;

//創(chuàng)建一個(gè)Application對(duì)象并使其可見
beforeTime?=?DateTime.Now;
app?=?new?Excel.ApplicationClass();
app.Visible?=?true;
afterTime?=?DateTime.Now;

//打開模板文件,得到WorkBook對(duì)象
workBook?=?app.Workbooks.Open(templetFilemissingmissingmissingmissingmissing
missingmissingmissingmissingmissingmissingmissing);

//得到WorkSheet對(duì)象
workSheet?=?(Excel.Worksheet)workBook.Sheets.get_Item(1);

}

///?
///?構(gòu)造函數(shù),打開一個(gè)已有的工作簿
///?

///?Excel文件名
public?ExcelHelper(string?fileName)
{
if(!File.Exists(fileName))
throw?new?Exception(“指定路徑的Excel文件不存在!“);

//創(chuàng)建一個(gè)Application對(duì)象并使其可見
beforeTime?=?DateTime.Now;
app?=?new?Excel.ApplicationClass();
app.Visible?=?true;
afterTime?=?DateTime.Now;

//打開一個(gè)WorkBook
workBook?

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????59142??2005-11-07?23:34??ExcelHelper.cs

?????文件??????72704??2011-10-17?19:58??C#調(diào)用Excel宏操作.doc

-----------?---------??----------?-----??----

???????????????131846????????????????????2


評(píng)論

共有 條評(píng)論