原文:
http://ittalk.blog.hexun.com/8373647_d.htmlusing 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);
}