我想使用EPPlus参考/打包打开Excel文档。我无法打开Excel应用程序。我错过了什么代码?使用EPPlus打开Excel文档
protected void BtnTest_Click(object sender, EventArgs e)
{
FileInfo newFile = new FileInfo("C:\\Users\\Scott.Atkinson\\Desktop\\Book.xls");
ExcelPackage pck = new ExcelPackage(newFile);
//Add the Content sheet
var ws = pck.Workbook.Worksheets.Add("Content");
ws.View.ShowGridLines = false;
ws.Column(4).OutlineLevel = 1;
ws.Column(4).Collapsed = true;
ws.Column(5).OutlineLevel = 1;
ws.Column(5).Collapsed = true;
ws.OutLineSummaryRight = true;
//Headers
ws.Cells["B1"].Value = "Name";
ws.Cells["C1"].Value = "Size";
ws.Cells["D1"].Value = "Created";
ws.Cells["E1"].Value = "Last modified";
ws.Cells["B1:E1"].Style.Font.Bold = true;
}
我已经试过pck.open(newFile);
,但不允许它...
是否要在Excel中打开电子表格? – 3aw5TZetdf 2012-08-10 08:13:04
是啊多数民众赞成在即时尝试做我只是想让它显示,所以我可以开始学习和使用它... – 2012-08-10 08:14:03
bool.xls是一个简单的Excel电子表格,坐在我的桌面 – 2012-08-10 08:14:42