www.un.org/Depts/DGACM/index_spanish.htm 是否有任何人知道如何开设和关闭Excel工作手册?
我无需阅读档案中的任何数据,我只需要公开和关闭。 (*)
我猜测,我需要参考微软。 办公室。 Excel Assembly。
*Reason:我已经与第三党图书馆(Aspose)配置了纸张资料。 现在,我需要读一下所产生的纸面表。
不幸的是,Aspose图书馆可以在操作时间制作纸张。 它需要有人到使Excel能够产生纸面值。
www.un.org/Depts/DGACM/index_spanish.htm 是否有任何人知道如何开设和关闭Excel工作手册?
我无需阅读档案中的任何数据,我只需要公开和关闭。 (*)
我猜测,我需要参考微软。 办公室。 Excel Assembly。
*Reason:我已经与第三党图书馆(Aspose)配置了纸张资料。 现在,我需要读一下所产生的纸面表。
不幸的是,Aspose图书馆可以在操作时间制作纸张。 它需要有人到使Excel能够产生纸面值。
在推荐Microsoft之后。 办公室。 Excel还确保最终清理。
using Excel = Microsoft.Office.Interop.Excel;
Excel.ApplicationClass _Excel;
Excel.Workbook WB;
Excel.Worksheet WS;
try
{
_Excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
WB = _Excel.Workbooks.Open("FILENAME",
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
//do something
}
catch (Exception ex)
{
WB.Close(false, Type.Missing, Type.Missing);
throw;
}
finally
{
GC.Collect();
GC.WaitForPendingFinalizers();
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(WB);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(_Excel);
}
快速谷歌给我说,这是在法典项目中:
考虑使用系统。 诊断。 启动、监测和关闭Excel进程。 该网站提供了一个良好的内涵:。 http://www.thescarms.com/dotnet/Process.aspx,包括使用无形窗口和向其发送材料。