diff --git a/CHANGELOG.md b/CHANGELOG.md index 11623f4..0e4bc16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ 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-rc38 (7. Dec, 2022) + +- fix #584 Remove `%` from width. ## docx-wasm@0.0.276-rc37 (28. Nov, 2022) - fixed a bug, `adjustLineHeightInTable` is not affected in js interface. diff --git a/docx-core/examples/reader.rs b/docx-core/examples/reader.rs index b41b58c..caac743 100644 --- a/docx-core/examples/reader.rs +++ b/docx-core/examples/reader.rs @@ -4,7 +4,7 @@ use std::fs::File; use std::io::{Read, Write}; pub fn main() { - let mut file = File::open("./rh.docx").unwrap(); + let mut file = File::open("./584.docx").unwrap(); let mut buf = vec![]; file.read_to_end(&mut buf).unwrap(); diff --git a/docx-core/src/reader/attributes/width.rs b/docx-core/src/reader/attributes/width.rs index 4ab9c09..8ec3d6d 100644 --- a/docx-core/src/reader/attributes/width.rs +++ b/docx-core/src/reader/attributes/width.rs @@ -14,7 +14,8 @@ pub fn read_width(attrs: &[OwnedAttribute]) -> Result<(isize, WidthType), Reader if local_name == "type" { width_type = WidthType::from_str(&a.value)?; } else if local_name == "w" { - w = f64::from_str(&a.value).expect("should read width.") as isize; + let v = a.value.replace("%", ""); + w = f64::from_str(&v).expect("should read width.") as isize; } } Ok((w, width_type)) diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 5fee07d..5ad239c 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.276-rc37", + "version": "0.0.276-rc38", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ",