From 47697f0fac7994b106797dcc99840474da67e45a Mon Sep 17 00:00:00 2001 From: bokuweb Date: Fri, 2 Dec 2022 13:35:43 +0900 Subject: [PATCH] fix: js adjust line table settings (#577) * fix: js adjust line table settings * fix: readme --- CHANGELOG.md | 4 ++++ docx-wasm/js/index.ts | 6 +++++- docx-wasm/js/section-property.ts | 6 ------ docx-wasm/js/settings.ts | 6 ++++++ docx-wasm/package.json | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8c77cd..11623f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## docx-wasm@0.0.276-rc37 (28. Nov, 2022) + +- fixed a bug, `adjustLineHeightInTable` is not affected in js interface. + ## docx-wasm@0.0.276-rc36 (16. Nov, 2022) - fix lineRule ts type diff --git a/docx-wasm/js/index.ts b/docx-wasm/js/index.ts index 54933b5..9fa9a67 100644 --- a/docx-wasm/js/index.ts +++ b/docx-wasm/js/index.ts @@ -182,7 +182,7 @@ export class Docx { } adjustLineHeightInTable() { - this.sectionProperty.adjustLineHeightInTable(); + this.settings.adjustLineHeightInTable(); return this; } @@ -765,6 +765,10 @@ export class Docx { docx = docx.doc_id(this.settings._docId); } + if (this.settings._adjustLineHeightInTable) { + docx = docx.set_adjust_line_height_in_table(); + } + docx = docx.default_tab_stop(this.settings._defaultTabStop); this.settings._docVars.forEach((v) => { diff --git a/docx-wasm/js/section-property.ts b/docx-wasm/js/section-property.ts index bc36ec6..6483c16 100644 --- a/docx-wasm/js/section-property.ts +++ b/docx-wasm/js/section-property.ts @@ -24,7 +24,6 @@ export class SectionProperty { _footer: Footer | null = null; _firstFooter: Footer | null = null; _evenFooter: Footer | null = null; - _adjustLineHeightInTable: boolean = false; pageSize(w: number, h: number) { this._pageSize.w = w; @@ -52,11 +51,6 @@ export class SectionProperty { return this; } - adjustLineHeightInTable() { - this._adjustLineHeightInTable = true; - return this; - } - firstHeader(header: Header) { this._firstHeader = header; return this; diff --git a/docx-wasm/js/settings.ts b/docx-wasm/js/settings.ts index f33af63..fed8750 100644 --- a/docx-wasm/js/settings.ts +++ b/docx-wasm/js/settings.ts @@ -7,6 +7,7 @@ export class Settings { _docId: string | null = null; _docVars: DocVar[] = []; _defaultTabStop = 840; + _adjustLineHeightInTable = false; docId(id: string) { this._docId = id; @@ -22,4 +23,9 @@ export class Settings { this._docVars.push({ name, val }); return this; } + + adjustLineHeightInTable() { + this._adjustLineHeightInTable = true; + return this; + } } diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 3c677a8..fc83976 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.276-rc36", + "version": "0.0.276-rc37", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ",