博客园 首页 联系 管理

2008年2月3日 #

摘要: 首先必须在项目中添加MS的Office组件,然后在代码文件中使用命名空间using Excel;接着就可以使用EXCEL对象了声明以下三个对象 Application myApp = null; Workbook myBook = null; Worksheet mySheet = null; myApp = new Application();//创建EXCEL应用对象//打开指定EXCEL文件模版 myBook = myApp.Workbooks.Open(FullPathFile, missing, missing, missing, missing, missing, missing, 阅读全文
posted @ 2008-02-03 16:31 CodeBlove 阅读(303) 评论(0) 推荐(0)

摘要: 本文将逐步收录工作中遇到的文件方面的操作方法。首先需要使用以下命名空间:using System.IO;然后要获得一个文件路径,如果在配置文件中使用了文件路径,就这样写:string WebPath,tmpPath;WebPath = ConfigurationManager.AppSettings["Path"];tmpPath = WebPath + "Temp\\";//拼装路径FileInfo NewFile//遍历目录中的文件DirectoryInfo tmpdir = new DirectoryInfo(tmpPath);//取得目录对象in 阅读全文
posted @ 2008-02-03 15:45 CodeBlove 阅读(194) 评论(0) 推荐(0)