diff --git a/public/temp/AR04_Cost and Expense Report.xlsx b/public/temp/AR04_Cost and Expense Report.xlsx index a414e1a..3ce7f59 100644 Binary files a/public/temp/AR04_Cost and Expense Report.xlsx and b/public/temp/AR04_Cost and Expense Report.xlsx differ diff --git a/public/temp/AR05_Project Completion Report.xlsx b/public/temp/AR05_Project Completion Report.xlsx index 60deae8..152541a 100644 Binary files a/public/temp/AR05_Project Completion Report.xlsx and b/public/temp/AR05_Project Completion Report.xlsx differ diff --git a/public/temp/AR06_Project Completion Report with Outstanding Un-billed Hours.xlsx b/public/temp/AR06_Project Completion Report with Outstanding Un-billed Hours.xlsx index 419bd2e..e6f1f35 100644 Binary files a/public/temp/AR06_Project Completion Report with Outstanding Un-billed Hours.xlsx and b/public/temp/AR06_Project Completion Report with Outstanding Un-billed Hours.xlsx differ diff --git a/src/components/Report/ReportSearchBox/SearchBox.tsx b/src/components/Report/ReportSearchBox/SearchBox.tsx index 67af5f2..463aa0c 100644 --- a/src/components/Report/ReportSearchBox/SearchBox.tsx +++ b/src/components/Report/ReportSearchBox/SearchBox.tsx @@ -140,17 +140,6 @@ function SearchBox({ 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({ 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) { diff --git a/src/components/Report/ReportSearchBox2/SearchBox2.tsx b/src/components/Report/ReportSearchBox2/SearchBox2.tsx index 7e3d6e9..7c524af 100644 --- a/src/components/Report/ReportSearchBox2/SearchBox2.tsx +++ b/src/components/Report/ReportSearchBox2/SearchBox2.tsx @@ -140,17 +140,6 @@ function SearchBox({ 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({ 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) { diff --git a/src/components/Report/ReportSearchBox3/SearchBox3.tsx b/src/components/Report/ReportSearchBox3/SearchBox3.tsx index b4a252d..aafa7d0 100644 --- a/src/components/Report/ReportSearchBox3/SearchBox3.tsx +++ b/src/components/Report/ReportSearchBox3/SearchBox3.tsx @@ -139,18 +139,7 @@ function SearchBox({ 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({ 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) { diff --git a/src/components/Report/ReportSearchBox4/SearchBox4.tsx b/src/components/Report/ReportSearchBox4/SearchBox4.tsx index 1ac6e7e..bc18492 100644 --- a/src/components/Report/ReportSearchBox4/SearchBox4.tsx +++ b/src/components/Report/ReportSearchBox4/SearchBox4.tsx @@ -140,17 +140,6 @@ function SearchBox({ 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({ 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) { diff --git a/src/components/Report/ReportSearchBox5/SearchBox5.tsx b/src/components/Report/ReportSearchBox5/SearchBox5.tsx index 2b0b7db..c28a0a3 100644 --- a/src/components/Report/ReportSearchBox5/SearchBox5.tsx +++ b/src/components/Report/ReportSearchBox5/SearchBox5.tsx @@ -139,18 +139,7 @@ function SearchBox({ 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({ 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) { diff --git a/src/components/Report/ReportSearchBox6/SearchBox6.tsx b/src/components/Report/ReportSearchBox6/SearchBox6.tsx index 4e7c82d..322644f 100644 --- a/src/components/Report/ReportSearchBox6/SearchBox6.tsx +++ b/src/components/Report/ReportSearchBox6/SearchBox6.tsx @@ -140,17 +140,6 @@ function SearchBox({ 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({ // 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) {