本文整理汇总了C#中Application类的典型用法代码示例。如果您正苦于以下问题:C#Application类的具体用法?C#Application怎么用?C#Application使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:ExecuteWork
//Thesheetsoftheworkbookare:
//Sheetnumber1:INPUTS
//Sheetnumber2:OUTPUTS
//Sheetnumber3:Cover
//Sheetnumber4:AmendmentRecord
//Sheetnumber5:Referencedocuments
//Sheetnumber6:Introduction
//Sheetnumber7:ETCSDMIinputs=>toimport
//Sheetnumber8:ETCSDMIoutputs=>toimport
//Sheetnumber9:INPUTITEMS
//Sheetnumber10:OUTPUTITEMS
//Sheetnumber11:ANALYSIS
///
///Launchesimportoftheexcelfileinthebackgroundtask
///
///
publicoverridevoidExecuteWork()
{
if(TheDictionary!=null)
{
Applicationapplication=newApplication();
if(application!=null)
{
Workbookworkbook=application.Workbooks.Open(FileName);
if(workbook.Sheets.Count==11)
{
SpecificationnewSpecification=(Specification)acceptor.getFactory().createSpecification();
newSpecification.Name="StartStopConditions";
TheDictionary.appendSpecifications(newSpecification);
ChapternewChapter=(Chapter)acceptor.getFactory().createChapter();
newChapter.setId("1-DMIinputs");
newSpecification.appendChapters(newChapter);
WorksheetaWorksheet=workbook.Sheets[7]asWorksheet;
importParagraphs(newChapter,"1",aWorksheet);
newChapter=(Chapter)acceptor.getFactory().createChapter();
newChapter.setId("2-DMIoutputs");
newSpecification.appendChapters(newChapter);
aWorksheet=workbook.Sheets[8]asWorksheet;
importParagraphs(newChapter,"2",aWorksheet);
}
workbook.Close(false);
}
else
{
Log.ErrorFormat("Errorwhileopeningtheexcelfile");
}
application.Quit();
}
}
原文链接:http://www.jxszl.com/biancheng/C/556560.html