Angular Excel 라이브러리 개요
The Infragistics Angular Excel Library allows you to work with spreadsheet data using familiar Microsoft® Excel® spreadsheet objects like workbook, Worksheet, Cell, Formula and many more. The Infragistics Angular Excel Library makes it easy for you to represent the data of your application in an Excel spreadsheet as well as transfer data from Excel into your application.
Angular Excel Library Example
Dependencies
엑셀 패키지 설치 시 코어 패키지도 함께 설치해야 합니다.
npm install --save igniteui-angular-core
npm install --save igniteui-angular-excel
Component Modules
Angular Excel 라이브러리에는 다음 모듈이 필요합니다.
// app.module.ts
import { IgxExcelModule } from 'igniteui-angular-excel';
@NgModule({
imports: [
// ...
IgxExcelModule,
// ...
]
})
export class AppModule {}
Modules Implementation
Excel 라이브러리에는 앱의 번들 크기를 제한하는 데 사용할 수 있는 5개의 모듈이 포함되어 있습니다.
- IgxExcelCoreModule– 여기에는 개체 모델과 Excel 인프라의 대부분이 포함되어 있습니다.
- IgxExcelFunctionsModule– 여기에는 Sum, Average, Min, Max 등과 같은 수식 평가를 위한 대부분의 함수가 포함되어 있습니다. 이 모듈이 없어도 수식을 계산할 경우 수식 구문 분석에 문제가 발생하지 않습니다. 예를 들어 “=SUM(A1:A5)”와 같은 수식을 적용하고 셀의 값을 요청하면 #NAME!이 표시됩니다. 오류가 반환되었습니다. 이는 예외 발생이 아닙니다. 수식으로 인해 오류가 발생할 수 있으므로 특정 오류를 나타내는 개체입니다.
- IgxExcelXlsModule– 여기에는 xls(및 관련) 유형 파일, 즉 Excel97to2003 관련 WorkbookFormats에 대한 로드 및 저장 논리가 포함되어 있습니다.
- IgxExcelXlsxModule– 여기에는 xlsx(및 관련) 유형 파일, 즉 Excel2007 관련 및 StrictOpenXml WorkbookFormats에 대한 로드 및 저장 논리가 포함되어 있습니다.
- IgxExcelModule– 이는 다른 4개의 모듈을 참조하므로 기본적으로 모든 기능이 로드/사용 가능하도록 보장합니다.
Supported Versions of Microsoft Excel
다음은 지원되는 Excel 버전 목록입니다.**
마이크로소프트 엑셀 97
마이크로소프트 엑셀 2000
마이크로소프트 엑셀 2002
마이크로소프트 엑셀 2003
마이크로소프트 엑셀 2007
마이크로소프트 엑셀 2010
마이크로소프트 엑셀 2013
마이크로소프트 엑셀 2016
Load and Save Workbooks
이제 Excel 라이브러리 모듈을 가져왔으므로 다음 단계는 통합 문서를 로드하는 것입니다.
In the following code snippet, an external ExcelUtility class is used to save and load a workbook.
In order to load and save workbook objects, you can utilize the save method of the actual workbook object, as well as its static Load method.
import { Workbook } from "igniteui-angular-excel";
import { WorkbookSaveOptions } from "igniteui-angular-excel";
import { WorkbookFormat } from "igniteui-angular-excel";
import { ExcelUtility } from "ExcelUtility";
var workbook = ExcelUtility.load(file);
ExcelUtility.save(workbook, "fileName");
Managing Heap
Excel 라이브러리의 크기로 인해 소스 맵 생성을 비활성화하는 것이 좋습니다.
Modify angular.json by setting the vendorSourceMap option under architect => build => options and under serve => options:
"architect": {
"build": {
"builder": "...",
"options": {
"vendorSourceMap": false,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
// ...
},
// ...
},
"serve": {
"builder": "...",
"options": {
"vendorSourceMap": false,
"browserTarget": "my-app:build"
},
// ...
},
// ...
}