From 05226cb82f6cc53f2ca340ef1a9735d464a284c8 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 02:19:14 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.templates.$templateId.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/routes/documents.templates.$templateId.tsx b/src/routes/documents.templates.$templateId.tsx index 94a0859..6a2783a 100644 --- a/src/routes/documents.templates.$templateId.tsx +++ b/src/routes/documents.templates.$templateId.tsx @@ -115,19 +115,30 @@ function TemplateDetailPage() { navigate({ to: "/documents/templates" }); }; + const isLetter = tpl?.kind === "correspondence"; + const fontFamily: string = tpl?.font_family || "Bookman Old Style"; + const fontSizePt: number = tpl?.font_size_pt || 12; + const downloadOnly = async () => { - await downloadGeneric({ title: docName, body: merged }, docName || "Document"); + await downloadGeneric( + { title: isLetter ? undefined : docName, body: merged, fontFamily, fontSizePt }, + docName || "Document", + ); }; const generateAndSave = async () => { setGenerating(true); try { const { Document, Paragraph, TextRun, AlignmentType } = await import("docx"); - const font = "Bookman Old Style", size = 24; + const font = fontFamily; + const size = fontSizePt * 2; const mkP = (text: string, bold = false, center = false) => new Paragraph({ alignment: center ? AlignmentType.CENTER : undefined, children: [new TextRun({ text, bold, font, size })] }); const children: any[] = []; - if (docName) { children.push(mkP(docName, true, true)); children.push(new Paragraph({ children: [new TextRun({ text: "", font, size })] })); } + if (docName && !isLetter) { + children.push(mkP(docName, true, true)); + children.push(new Paragraph({ children: [new TextRun({ text: "", font, size })] })); + } merged.split("\n").forEach((line) => children.push(mkP(line))); const doc = new Document({ styles: { default: { document: { run: { font, size } } } },