IT 지식 기록/반도체 SW
c# datagridview to excel export, winform excel 추출, workbook 관련 정리
(╹◡╹)_
2021. 4. 13. 16:25
728x90
Microsoft Office Excel 워크시트를 만들고 표시하는 코드
Visual C#, Windows, .NET Framework
using excel = Microsoft.Office.Interop.Excel;
정보를 Excel로 내보내는 메서드
Add 메서드 : 특정 템플릿을 지정하기 위한 선택적 매개 변수
인수가 전송되지 않으면 Add는 기본 템플릿을 사용하며 새 통합 문서를 만든다.
var excelApp = new excel.Application();
excelApp.Workbooks.Add();
- Create a new, empty workbook and add it to the colleciton returned by property workbooks
- The new workbook becomes the active workbook
- Add has an optional parameter for specifying a particular template
- Because no argument is sent is this example, Add creates a new workbook
excel.Worksheet workSheet = (excel.Worksheet)excelApp.ActiveSheet;
- This example uses a single workSheet.
- Teh explicit type casting is removed in a later procedure
[ing]
참고
Office interop 개체에 액세스하는 방법 - C# 프로그래밍 가이드
Office API 개체에 간편하게 액세스할 수 있는 C# 기능에 대해 알아봅니다. 새 기능을 사용하여 Excel 워크시트를 만들고 표시하는 코드를 작성합니다.
docs.microsoft.com
728x90