- 패키지 설치
npm install html-docx-js-typescript --save-dev
- include
import { asBlob } from 'html-docx-js-typescript'
// if you want to save the docx file, you need
import 'file-saver' import { saveAs } from 'file-saver'
- 예제
handleClickWordSaveButton = () => {
asBlob('html data').then(data => {
saveAs(data, '문서명' + '.docx') // save as docx file
}) // asBlob() return Promise
}
"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."
- 참고
github.com/caiyexiang/html-docx-js-typescript
'IT관련 > REACT' 카테고리의 다른 글
CKEditor 툴바 커스텀(React) (0) | 2021.01.18 |
---|---|
nhn / tui.grid 선택한 rows id 값 가져오기 (0) | 2021.01.11 |
React Html 데이터 출력하기(print) (0) | 2020.12.09 |
React + CKEditor 4 사용하기 (0) | 2020.12.03 |
React에서 TOAST UI Editor(Web Editor 사용하기) (0) | 2020.11.23 |