@@ -331,32 +331,13 @@ async function main() {
331331
332332 // 목차 시트에 내용 채우기
333333 if ( createdSheetNames . length > 0 && tocSheet ) {
334- // 이미 생성된 목차 시트에 내용 추가
335- tocSheet . addRow ( [ 'No' , 'Sheet Name' , 'Data Count' ] ) ;
336- createdSheetNames . forEach ( ( obj , idx ) => {
337- const row = tocSheet . addRow ( [ idx + 1 , obj . displayName , createdSheetCounts [ idx ] ] ) ;
338- // 시트명에 하이퍼링크 추가 (실제 탭 이름 기준)
339- row . getCell ( 2 ) . value = {
340- text : obj . displayName ,
341- hyperlink : `#'${ obj . tabName } '!A1`
342- } ;
343- row . getCell ( 2 ) . font = { color : { argb : '0563C1' } , underline : true } ;
344- // 데이터 건수에도 하이퍼링크 추가
345- row . getCell ( 3 ) . value = {
346- text : createdSheetCounts [ idx ] . toString ( ) ,
347- hyperlink : `#'${ obj . tabName } '!A1`
348- } ;
349- row . getCell ( 3 ) . font = { color : { argb : '0563C1' } , underline : true } ;
350- } ) ;
334+ // excel-style-helper 모듈의 함수 사용하여 안전한 목차 생성
335+ excelStyleHelper . populateTableOfContents ( tocSheet , createdSheetNames ) ;
336+
351337 // 목차 시트를 첫 번째로 이동
352338 workbook . worksheets = [ tocSheet , ...workbook . worksheets . filter ( ws => ws . name !== '목차' ) ] ;
353- // 간단한 스타일
354- tocSheet . getRow ( 1 ) . font = { bold : true } ;
355- tocSheet . columns = [
356- { header : 'No' , key : 'no' , width : 6 } ,
357- { header : 'Sheet Name' , key : 'name' , width : 30 } ,
358- { header : 'Data Count' , key : 'count' , width : 12 }
359- ] ;
339+
340+ console . log ( `[목차] 내용 채우기 완료 (총 ${ createdSheetNames . length } 개 시트)` ) ;
360341
361342 if ( createSeparateToc ) {
362343 // 별도 목차 엑셀 파일 생성
0 commit comments