728x90
반응형
xlsx 를 서버에서 poi 로 생성하려는 고정 관념이 너무세개 박혔었다.
이 두개면 충분 할 것을 ;;;
npm install xlsx file-saver -S
npm install script-loader -S -D
, async downloadByQuestionExcelSample (){
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
const list = [{id : 1, title : 'binsoo' , author : 's' , pageviews : 0, display_time : 3303 }]
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: this.filename,
autoWidth: this.autoWidth,
bookType: this.bookType
})
})
}
, formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
if (j === 'timestamp') {
return parseTime(v[j])
} else {
return v[j]
}
}))
}
🖤 글이 도움이 되었다면 유튜브 클릭 해주세요 🖤
https://www.youtube.com/channel/UCgkxlLdjrlsFyp2GGxzY59A
728x90
반응형
'개발중 > JavaScript' 카테고리의 다른 글
🔍🔊 배열에 특정 값이 포함되어 있는지 여부 체크하기 🔊🔍 (0) | 2022.02.24 |
---|---|
🔍🔊 split 사용 - 문자열 배열로 변경 ( 특정 문자 기준 ) 🔊🔍 (0) | 2022.02.24 |
프로미스 / Promises (0) | 2021.11.16 |
lodash remove (0) | 2021.11.04 |
._find 객체 배열 특정 객체 찾기 (0) | 2021.10.06 |