Angular에 통합하기

설치 및 기본 사용로 시작. 아래 예제는 Angular 구성품을 사용하여 Univer Pdf를 명시된 높이로 컨테이너에 마운트합니다.

통합 단계

  1. ngAfterViewInit에서 Univer 인스턴스를 만듭니다.
  2. ngOnDestroy에서 인스턴스의 처리.

플러그인 설정

UniverUIPlugin

  • container
    string | HTMLElement
    편집기를 마운트할 DOM 요소 또는 요소 ID입니다.

UniverLicensePlugin

  • license
    string
    클라이언트 라이선스 파일의 내용입니다.

예제 코드

TypeScript
import type { AfterViewInit, ElementRef, OnDestroy } from '@angular/core'import { Component, ViewChild } from '@angular/core'import { UniverLicensePlugin } from '@univerjs-pro/license'import { UniverPdfsPlugin } from '@univerjs-pro/pdfs'import { UniverPdfsUIPlugin } from '@univerjs-pro/pdfs-ui'import PdfsUIkoKR from '@univerjs-pro/pdfs-ui/locale/ko-KR'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { FUniver } from '@univerjs/core/facade'import DesignkoKR from '@univerjs/design/locale/ko-KR'import { UniverUIPlugin } from '@univerjs/ui'import UIkoKR from '@univerjs/ui/locale/ko-KR'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs-pro/pdfs-ui/lib/index.css'import '@univerjs-pro/pdfs/facade'@Component({  selector: 'app-univer',  standalone: true,  template: '<div #container style="height: 600px"></div>',})export class UniverComponent implements AfterViewInit, OnDestroy {  @ViewChild('container') containerRef!: ElementRef<HTMLDivElement>  private univer?: Univer  ngAfterViewInit() {    const container = this.containerRef.nativeElement    const univer = new Univer({      locale: LocaleType.KO_KR,      locales: {        [LocaleType.KO_KR]: mergeLocales(          DesignkoKR,          UIkoKR,          PdfsUIkoKR,        ),      },    })    univer.registerPlugin(UniverLicensePlugin, {      license: 'your license.txt',    })    univer.registerPlugin(UniverUIPlugin, { container })    univer.registerPlugin(UniverPdfsPlugin)    univer.registerPlugin(UniverPdfsUIPlugin)    const univerAPI = FUniver.newAPI(univer)    univerAPI.createPdf({ name: 'Untitled PDF' })    this.univer = univer  }  ngOnDestroy() {    this.univer?.dispose()  }}

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.