Quote:An exception of type 'System.Exception' occurred in EPPlus.dll but was not handled in user code Additional information: Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password
protected void check(object sender, EventArgs e) { if (FileUpload1.HasFile) { string filename = "Hr_Report_" + DateTime.Now.ToString("dddd_dd_MMMM_yyyy") + ".xlsx"; FileUpload1.SaveAs(temp_file + filename); string tempfile = temp_file + filename; string c = @tempfile; DataTable table = new DataTable(); FileInfo existingFile = new FileInfo(tempfile); //+ FileUpload1.FileName); using (ExcelPackage package = new ExcelPackage(existingFile)) { ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; int colCount = worksheet.Dimension.End.Column; int rowCount = worksheet.Dimension.End.Row; table.Columns.Add("Emp_NIK", typeof(string)); table.Columns.Add("Timer_Finger", typeof(DateTime)); table.Columns.Add("Status", typeof(string)); for (int i = 1; i < rowCount; i++) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = worksheet.Cells[i + 1, 2].Text.ToString();//+worksheet.Cells[i + 1, 3].Value.ToString() + " " + worksheet.Cells[i + 1, 2].Value.ToString() + " Baris ke " + i; row.Cells.Add(cell1); myTable.Rows.Add(row); } } } else { Response.Write("<script>window.alert('File Belum diupload')</script>"); } }
ExcelFile.Load
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)