From 3dc2a59ede83094578cedbc6af0dac051e65bcfa Mon Sep 17 00:00:00 2001 From: bokuweb Date: Sun, 15 Dec 2019 00:39:01 +0900 Subject: [PATCH] feat: Support table width (#12) --- docx-core/src/documents/elements/table.rs | 5 +++++ docx-wasm/src/table.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/docx-core/src/documents/elements/table.rs b/docx-core/src/documents/elements/table.rs index d83b670..0580158 100644 --- a/docx-core/src/documents/elements/table.rs +++ b/docx-core/src/documents/elements/table.rs @@ -35,6 +35,11 @@ impl Table { self.property = self.property.align(v); self } + + pub fn width(mut self, w: usize) -> Table { + self.property = self.property.width(w, WidthType::DXA); + self + } } impl BuildXML for Table { diff --git a/docx-wasm/src/table.rs b/docx-wasm/src/table.rs index 1dd0c73..4df7fdd 100644 --- a/docx-wasm/src/table.rs +++ b/docx-wasm/src/table.rs @@ -38,4 +38,9 @@ impl Table { self.0 = self.0.align(v); self } + + pub fn width(mut self, w: usize) -> Table { + self.0 = self.0.width(w); + self + } }