From 94a09ce76b9908b0d851c0c2a5d3391d93efbb48 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 02:10:30 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index f1888df..743c7e0 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -564,13 +564,14 @@ export function CustomFormBuilder() { children.push(new DocxParagraph({ text: "" })); } - const tableBorder = { style: BorderStyle.SINGLE, size: 4, color: "999999" }; - const cellBorders = { - top: tableBorder, - bottom: tableBorder, - left: tableBorder, - right: tableBorder, - }; + const onBorder = { style: BorderStyle.SINGLE, size: 4, color: "999999" }; + const offBorder = { style: BorderStyle.NONE, size: 0, color: "FFFFFF" }; + const docxBorders = (b: CellBorders) => ({ + top: b.t ? onBorder : offBorder, + bottom: b.b ? onBorder : offBorder, + left: b.l ? onBorder : offBorder, + right: b.r ? onBorder : offBorder, + }); for (const seg of segments) { if (seg.kind === "table") { @@ -582,19 +583,21 @@ export function CustomFormBuilder() { width: { size: totalW, type: WidthType.DXA }, columnWidths: Array(cols).fill(colW), rows: seg.rows.map( - (row, ri) => + (row) => new DocxTableRow({ children: Array.from({ length: cols }).map((_, ci) => { - const isHeader = seg.hasHeader && ri === 0; + const cell = row[ci]; + const borders = cell?.borders ?? DEFAULT_BORDERS; + const isHeader = cell?.isHeader ?? false; return new DocxTableCell({ - borders: cellBorders, + borders: docxBorders(borders), width: { size: colW, type: WidthType.DXA }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [ new DocxParagraph({ children: [ new TextRun({ - text: applyVariables(row[ci] ?? "", ctx), + text: applyVariables(cell?.text ?? "", ctx), font: fontFamily, size: fontSize * 2, bold: isHeader,