주석을 봐주세요...
for (const i in ws) { // 모든 cell을 돌겠다
if (typeof (ws[i]) !== 'object') continue; // object가 아니면 style 적용 안됨
ws[i].s = { // 모든 cell 에 style을 적용
alignment: {
horizontal: 'center',
},
border: {
right: {
style: 'thin',
color: '000000',
},
left: {
style: 'thin',
color: '000000',
},
top: {
style: 'thin',
color: '000000',
},
bottom: {
style: 'thin',
color: '000000',
},
},
}
여기서 i는 number가 아니라 string이다. 왜냐면 cell의 이름을 나타내기 때문이다. ex) A1, A2, B13
'Javascript' 카테고리의 다른 글
javascript 익명 함수 정리 (0) | 2022.05.17 |
---|---|
Javascript 스코프(scope) / 클로저(closure) 정리 (0) | 2022.05.17 |
javascript sheetjs , xlsx cell value에 따라 cell style 적용하기 (0) | 2022.04.15 |
Ajax를 이용한 file upload & download (0) | 2021.12.10 |
바닐라 자바스크립트와 ES6 자바스크립트 차이점 (0) | 2021.11.03 |