@@ -140,17 +140,6 @@ function SearchBox<T extends string>({ | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -195,6 +184,17 @@ function SearchBox<T extends string>({ | |||
lastRowOfFirstTable++; | |||
} | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||
@@ -140,17 +140,6 @@ function SearchBox<T extends string>({ | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -195,6 +184,17 @@ function SearchBox<T extends string>({ | |||
lastRowOfFirstTable++; | |||
} | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||
@@ -139,18 +139,7 @@ function SearchBox<T extends string>({ | |||
const date = new Date().toISOString().split('T')[0]; // Format YYYY-MM-DD | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -195,6 +184,17 @@ function SearchBox<T extends string>({ | |||
lastRowOfFirstTable++; | |||
} | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||
@@ -140,17 +140,6 @@ function SearchBox<T extends string>({ | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -195,6 +184,17 @@ function SearchBox<T extends string>({ | |||
lastRowOfFirstTable++; | |||
} | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||
@@ -139,18 +139,7 @@ function SearchBox<T extends string>({ | |||
const date = new Date().toISOString().split('T')[0]; // Format YYYY-MM-DD | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -195,6 +184,17 @@ function SearchBox<T extends string>({ | |||
lastRowOfFirstTable++; | |||
} | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||
@@ -140,17 +140,6 @@ function SearchBox<T extends string>({ | |||
const formattedDate = date.replace(/-/g, '/'); // Change format to YYYY/MM/DD | |||
XLSX.utils.sheet_add_aoa(worksheet, [[formattedDate]], { origin: cellAddress }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Style for cell A1: Font size 16 and bold | |||
if (worksheet['A1']) { | |||
worksheet['A1'].s = { | |||
@@ -198,6 +187,17 @@ function SearchBox<T extends string>({ | |||
// Insert the first data form into the worksheet at the desired location | |||
XLSX.utils.sheet_add_aoa(worksheet, firstTableData, { origin: { c: 0, r: lastRowOfFirstTable } }); | |||
// Calculate the maximum length of content in each column and set column width | |||
const colWidths: number[] = []; | |||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: "", blankrows: true }) as (string | number)[][]; | |||
jsonData.forEach((row: (string | number)[]) => { | |||
row.forEach((cell: string | number, index: number) => { | |||
const valueLength = cell.toString().length; | |||
colWidths[index] = Math.max(colWidths[index] || 0, valueLength); | |||
}); | |||
}); | |||
// Apply calculated widths to each column, skipping column A | |||
worksheet['!cols'] = colWidths.map((width, index) => { | |||
if (index === 0) { | |||