From 4437a6856f00aaf18fcabbf632ca22ee527aec6c Mon Sep 17 00:00:00 2001 From: Fernando Date: Mon, 15 May 2023 11:48:22 -0500 Subject: [PATCH] [docx] Fix position error in libre/only office --- docx/main.ts | 33 ++++----------------------------- src/certs/MATPEL.ts | 24 ------------------------ 2 files changed, 4 insertions(+), 53 deletions(-) diff --git a/docx/main.ts b/docx/main.ts index edb8710..c68a208 100644 --- a/docx/main.ts +++ b/docx/main.ts @@ -8,6 +8,7 @@ import { VerticalPositionAlign, TextRun, AlignmentType, + ShadingType, } from "docx"; import { join } from "path"; import * as QR from "qrcode"; @@ -277,10 +278,6 @@ const certificateName = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -305,10 +302,6 @@ const certificatePersonName = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -336,10 +329,6 @@ const certificateExpedite = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -364,10 +353,6 @@ const certificateCode = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -392,10 +377,6 @@ const certificateBody = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -442,10 +423,6 @@ const certificateFinishLabel = new Paragraph({ horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -455,6 +432,7 @@ const certificateFinishLabel = new Paragraph({ }), ], alignment: AlignmentType.CENTER, + style: "highlighting: none;", }); // Fecha de Emision: ... @@ -468,11 +446,7 @@ const certificateDate = new Paragraph({ height: cmText(1.4), anchor: { horizontal: FrameAnchorType.MARGIN, - vertical: FrameAnchorType.MARGIN, - }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, + vertical: FrameAnchorType.TEXT, }, }, children: [ @@ -490,6 +464,7 @@ const certificateDate = new Paragraph({ }), ], alignment: AlignmentType.LEFT, + style: "highlighting: none;", }); diff --git a/src/certs/MATPEL.ts b/src/certs/MATPEL.ts index f2c6933..7259d7b 100644 --- a/src/certs/MATPEL.ts +++ b/src/certs/MATPEL.ts @@ -160,10 +160,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -188,10 +184,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -219,10 +211,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -275,10 +263,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -325,10 +309,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({ @@ -353,10 +333,6 @@ export async function matpelCert(props: CertData): Promise { horizontal: FrameAnchorType.MARGIN, vertical: FrameAnchorType.MARGIN, }, - alignment: { - x: HorizontalPositionAlign.CENTER, - y: VerticalPositionAlign.TOP, - }, }, children: [ new TextRun({