摘要: 一、获取当前文件的路径1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName 获取模块的完整路径,包括文件名。2. System.Environment.CurrentDirectory 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。3. System.IO.Directory.GetCurrentDirectory() 获取应用程序的当前工作目录。这个不一定是程序从中启动的目录啊,有可能程序放在C:/www里,这个函数有可能返回C:/Documents and Settings/ZYB/,或者C: 阅读全文
posted @ 2012-05-23 13:16 任锋 阅读(457) 评论(0) 推荐(2) 编辑
摘要: using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using Excel = Microsoft.Office.Interop.Excel;namespace ExcelOperation{ public class ExcelControl { private Excel.Application m_objExcel = null; private Excel.Workbooks m_objBooks = null; private Excel._Workboo 阅读全文
posted @ 2012-05-23 12:42 任锋 阅读(329) 评论(0) 推荐(0) 编辑
摘要: Application app = new ApplicationClass(); try{ //让后台执行设置为不可见 app.Visible = false; //新增加一个工作簿 Workbook wBook = app.Workbooks.Add(true); //如果要打开已有的工作簿,则使用下面的注释语句 // Workbook wBook = app.Workbooks.Open(@"D:\1.xlsx", // missing, missing, missing, missing, missing, missing, missing, // missing, 阅读全文
posted @ 2012-05-23 11:20 任锋 阅读(1379) 评论(0) 推荐(0) 编辑