From d901842d51e9ddc455a7398856657a35eac2e456 Mon Sep 17 00:00:00 2001 From: bokuweb Date: Thu, 10 Aug 2023 18:09:52 +0900 Subject: [PATCH] fix: spacing type (#644) * fix: spacing type * fix --- CHANGELOG.md | 8 ++++++++ docx-core/src/documents/elements/line_spacing.rs | 6 +++--- docx-core/src/reader/attributes/line_spacing.rs | 2 +- docx-core/src/xml_builder/elements.rs | 2 +- docx-wasm/package.json | 2 +- docx-wasm/src/line_spacing.rs | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c0e49..d08e1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ 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.278-rc19 (9. Aug, 2023) + +- use i32 for line instead of u32. + +## docx-wasm@0.0.278-rc18 (24. Jul, 2023) + +- read caps. + ## docx-wasm@0.0.278-rc16 (14. Jul, 2023) - Improve read numbering types. diff --git a/docx-core/src/documents/elements/line_spacing.rs b/docx-core/src/documents/elements/line_spacing.rs index 34486c2..6007f3e 100644 --- a/docx-core/src/documents/elements/line_spacing.rs +++ b/docx-core/src/documents/elements/line_spacing.rs @@ -18,7 +18,7 @@ pub struct LineSpacing { #[serde(skip_serializing_if = "Option::is_none")] after_lines: Option, #[serde(skip_serializing_if = "Option::is_none")] - line: Option, + line: Option, } impl LineSpacing { @@ -51,8 +51,8 @@ impl LineSpacing { self } - pub fn line(mut self, line: u32) -> Self { - self.line = Some(line); + pub fn line(mut self, line: i32) -> Self { + self.line = Some(line as i32); self } } diff --git a/docx-core/src/reader/attributes/line_spacing.rs b/docx-core/src/reader/attributes/line_spacing.rs index aa81cd9..760ea7b 100644 --- a/docx-core/src/reader/attributes/line_spacing.rs +++ b/docx-core/src/reader/attributes/line_spacing.rs @@ -16,7 +16,7 @@ pub fn read_line_spacing(attributes: &[OwnedAttribute]) -> Result { - spacing = spacing.line(f64::from_str(&a.value)? as u32); + spacing = spacing.line(f64::from_str(&a.value)? as i32); } "lineRule" => { spacing = spacing.line_rule(LineSpacingType::from_str(&a.value)?); diff --git a/docx-core/src/xml_builder/elements.rs b/docx-core/src/xml_builder/elements.rs index 832d633..77bfef0 100644 --- a/docx-core/src/xml_builder/elements.rs +++ b/docx-core/src/xml_builder/elements.rs @@ -253,7 +253,7 @@ impl XMLBuilder { mut self, before: Option, after: Option, - line: Option, + line: Option, before_lines: Option, after_lines: Option, spacing: Option, diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 5fec2cd..7f5bb4e 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.278-rc18", + "version": "0.0.278-rc19", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ", diff --git a/docx-wasm/src/line_spacing.rs b/docx-wasm/src/line_spacing.rs index 3694977..297c02c 100644 --- a/docx-wasm/src/line_spacing.rs +++ b/docx-wasm/src/line_spacing.rs @@ -43,7 +43,7 @@ impl LineSpacing { } pub fn line(mut self, line: u32) -> Self { - self.0 = self.0.line(line); + self.0 = self.0.line(line as i32); self } }