Application AppExcel = null;
Workbook workBook = null;
Worksheet workSheet = null;
try
{
AppExcel = new Application
{
Visible = true
};
workBook = AppExcel.Workbooks.Add();
workSheet = workBook.Worksheets.Add(Before: workBook.Worksheets.Item[1]);
// 여기에 코드를 작성하시오
workBook.SaveAs(@"d:\"+ DateTime.Now.ToString("HHmmss")+".xlsx", XlFileFormat.xlWorkbookDefault);
}
catch (Exception e)
{
}
finally
{
workBook.Close();
AppExcel.Quit();
Marshal.ReleaseComObject(workSheet);
Marshal.ReleaseComObject(workBook);
Marshal.ReleaseComObject(AppExcel);
}
'C# Programming' 카테고리의 다른 글
C# Json 변환 읽기 (0) | 2022.05.15 |
---|---|
C# 엑셀 열 정렬하기 (0) | 2022.05.06 |
C# DoubleBuffered (0) | 2021.12.23 |
C# Flicker (0) | 2021.12.23 |
C# WinForm - FormBorderStyle이 None인 폼 크기 조절하기 (1) | 2021.11.11 |