[#584] fix: remove % (#585)

* fix: remove %

* fix
main
bokuweb 2022-12-07 16:40:55 +09:00 committed by GitHub
parent 8e29fa387d
commit c4f9ba0e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -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/), 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). 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) ## docx-wasm@0.0.276-rc37 (28. Nov, 2022)
- fixed a bug, `adjustLineHeightInTable` is not affected in js interface. - fixed a bug, `adjustLineHeightInTable` is not affected in js interface.

View File

@ -4,7 +4,7 @@ use std::fs::File;
use std::io::{Read, Write}; use std::io::{Read, Write};
pub fn main() { pub fn main() {
let mut file = File::open("./rh.docx").unwrap(); let mut file = File::open("./584.docx").unwrap();
let mut buf = vec![]; let mut buf = vec![];
file.read_to_end(&mut buf).unwrap(); file.read_to_end(&mut buf).unwrap();

View File

@ -14,7 +14,8 @@ pub fn read_width(attrs: &[OwnedAttribute]) -> Result<(isize, WidthType), Reader
if local_name == "type" { if local_name == "type" {
width_type = WidthType::from_str(&a.value)?; width_type = WidthType::from_str(&a.value)?;
} else if local_name == "w" { } 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)) Ok((w, width_type))

View File

@ -1,6 +1,6 @@
{ {
"name": "docx-wasm", "name": "docx-wasm",
"version": "0.0.276-rc37", "version": "0.0.276-rc38",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"browser": "dist/web/index.js", "browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>", "author": "bokuweb <bokuweb12@gmail.com>",