1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | Excel.Application eApplication = null; Excel.Workbook eWorkBook = null; Excel.Sheets eSheets = null; Excel.Worksheet eWorkSheet = null; Excel.Range srcRange = null; Excel.Range dstRange = null; string AppPath = Application.StartupPath; //Project path eApplication = new Excel.Application(); //Execute Excel eApplication.Visible = false; eWorkBook = eApplication.Workbooks.Open(AppPath + @"\jhhyun_test.xls"); eSheets = eWorkBook.Sheets; eWorkSheet = eSheets["Sheet1"] as Excel.Worksheet; /*Excel to PDF*/ object paramMissing = Type.Missing; string paramExportFilePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\1_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".pdf"; Excel.XlFixedFormatType paramExportFormat = Excel.XlFixedFormatType.xlTypePDF; Excel.XlFixedFormatQuality paramExportQuality = Excel.XlFixedFormatQuality.xlQualityStandard; bool paramOpenAfterPublish = false; bool paramIncludeDocProps = true; bool paramIgnorePrintAreas = true; object paramFromPage = Type.Missing; object paramToPage = Type.Missing; eWorkBook.ExportAsFixedFormat(paramExportFormat, paramExportFilePath, paramExportQuality, paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage, paramToPage, paramOpenAfterPublish, paramMissing); eWorkBook.Close(false); eWorkBook = null; eApplication.Quit(); eApplication = null; | cs |
'C#' 카테고리의 다른 글
C# 정규식을 이용하여 문자열이 숫자인지 판단 (0) | 2019.09.19 |
---|---|
C# ListView 복사 붙여넣기 (0) | 2019.09.19 |
C# DataTable to MSSQL Table (21/02/23 수정) (0) | 2018.12.22 |
C# MSSQL LEFT, RIGHT 와 동일한 함수 (0) | 2018.12.22 |
C# Excel 업로드 (0) | 2018.12.22 |