how to close excel work sheet,i want save only excel worksheet not open,this code save and open excel worksheet how to avoid that
for (int h = 0; h < Dtb.Rows.Count; h++)
{
for (int j = 0; j < Dtb.Columns.Count; j++)//dataGridView1.Columns.Count
{
wksht.Cells[h + 1, j + 1] = Dtb.Rows[h].ItemArray[j];
}
}
wksht.SaveAs("C:\\Barcodes\\New\\" + BatchCode + " " + Date + "_" + k + ".xlsx");
我尝试下面的代码,并为我工作正常。
workbook.SaveAs(exportpathtxt.Text, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.