首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

[C#]将excel文件转换为html资料

2012-11-18 
[C#]将excel文件转换为html文件原文:http://ittalk.blog.hexun.com/8373647_d.htmlusing Excelusing Syst

[C#]将excel文件转换为html文件

原文:

http://ittalk.blog.hexun.com/8373647_d.html

using Excel;
using System.Reflection;?

?public void ReadExcel(string rFilePath,string rHtmlFilePath)
??{
???Excel.Application?? repExcel?? =?? new Excel.Application();???
???Excel.Workbook?? workbook?? =?? null;???
????
???//xlsFile为Excel文件路径???
???workbook?? =?? repExcel.Application.Workbooks.Open(rFilePath,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value);?????
????
???//htmlFile?? 是要另存的html文件名??

???object?? ofmt?? =?? Excel.XlFileFormat.xlHtml;???
???workbook.SaveAs(rHtmlFilePath,???
????ofmt,???
????Missing.Value,???
????Missing.Value,???
????Missing.Value,???
????Missing.Value,
????Excel.XlSaveAsAccessMode.xlNoChange,???
????Missing.Value,???
????Missing.Value,
????Missing.Value,
????Missing.Value,
????Missing.Value);???
????
???object?? osave?? =?? false;???
???workbook.Close(osave,Missing.Value,Missing.Value);??

??}

热点排行