parent
be3a9ac701
commit
b6d01b1930
|
@ -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/),
|
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.278-rc16 (14. Jul, 2023)
|
||||||
|
|
||||||
|
- Improve read numbering types.
|
||||||
|
|
||||||
## docx-wasm@0.0.278-rc15 (23. Jun, 2023)
|
## docx-wasm@0.0.278-rc15 (23. Jun, 2023)
|
||||||
|
|
||||||
- Make docGrid Optional in sectionProperty
|
- Make docGrid Optional in sectionProperty
|
||||||
|
|
|
@ -23,9 +23,9 @@ pub fn read_border(attrs: &[OwnedAttribute]) -> Result<BorderAttrs, ReaderError>
|
||||||
if local_name == "color" {
|
if local_name == "color" {
|
||||||
color = a.value.to_owned();
|
color = a.value.to_owned();
|
||||||
} else if local_name == "sz" {
|
} else if local_name == "sz" {
|
||||||
size = Some(u32::from_str(&a.value)?);
|
size = Some(f64::from_str(&a.value)? as u32);
|
||||||
} else if local_name == "space" {
|
} else if local_name == "space" {
|
||||||
space = Some(u32::from_str(&a.value)?);
|
space = Some(f64::from_str(&a.value)? as u32);
|
||||||
} else if local_name == "val" {
|
} else if local_name == "val" {
|
||||||
border_type = BorderType::from_str(&a.value)?;
|
border_type = BorderType::from_str(&a.value)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn read_indent(attrs: &[OwnedAttribute]) -> ReadIndentResult {
|
||||||
let v = super::value_to_dax(&a.value)?;
|
let v = super::value_to_dax(&a.value)?;
|
||||||
start = Some(v);
|
start = Some(v);
|
||||||
} else if local_name == "leftChars" || local_name == "startChars" {
|
} else if local_name == "leftChars" || local_name == "startChars" {
|
||||||
start_chars = Some(i32::from_str(&a.value)?);
|
start_chars = Some(f64::from_str(&a.value)? as i32);
|
||||||
} else if local_name == "end" || local_name == "right" {
|
} else if local_name == "end" || local_name == "right" {
|
||||||
let v = super::value_to_dax(&a.value)?;
|
let v = super::value_to_dax(&a.value)?;
|
||||||
end = Some(v);
|
end = Some(v);
|
||||||
|
@ -42,12 +42,12 @@ pub fn read_indent(attrs: &[OwnedAttribute]) -> ReadIndentResult {
|
||||||
let v = super::value_to_dax(&a.value)?;
|
let v = super::value_to_dax(&a.value)?;
|
||||||
special = Some(SpecialIndentType::FirstLine(v))
|
special = Some(SpecialIndentType::FirstLine(v))
|
||||||
} else if local_name == "firstLineChars" {
|
} else if local_name == "firstLineChars" {
|
||||||
if let Ok(chars) = i32::from_str(&a.value) {
|
if let Ok(chars) = f64::from_str(&a.value) {
|
||||||
first_line_chars = Some(chars);
|
first_line_chars = Some(chars as i32);
|
||||||
}
|
}
|
||||||
} else if local_name == "hangingChars" {
|
} else if local_name == "hangingChars" {
|
||||||
if let Ok(chars) = i32::from_str(&a.value) {
|
if let Ok(chars) = f64::from_str(&a.value) {
|
||||||
hanging_chars = Some(chars);
|
hanging_chars = Some(chars as i32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,22 +10,22 @@ pub fn read_line_spacing(attributes: &[OwnedAttribute]) -> Result<LineSpacing, R
|
||||||
let local_name = &a.name.local_name;
|
let local_name = &a.name.local_name;
|
||||||
match local_name.as_str() {
|
match local_name.as_str() {
|
||||||
"before" => {
|
"before" => {
|
||||||
spacing = spacing.before(u32::from_str(&a.value)?);
|
spacing = spacing.before(f64::from_str(&a.value)? as u32);
|
||||||
}
|
}
|
||||||
"after" => {
|
"after" => {
|
||||||
spacing = spacing.after(u32::from_str(&a.value)?);
|
spacing = spacing.after(f64::from_str(&a.value)? as u32);
|
||||||
}
|
}
|
||||||
"line" => {
|
"line" => {
|
||||||
spacing = spacing.line(u32::from_str(&a.value)?);
|
spacing = spacing.line(f64::from_str(&a.value)? as u32);
|
||||||
}
|
}
|
||||||
"lineRule" => {
|
"lineRule" => {
|
||||||
spacing = spacing.line_rule(LineSpacingType::from_str(&a.value)?);
|
spacing = spacing.line_rule(LineSpacingType::from_str(&a.value)?);
|
||||||
}
|
}
|
||||||
"beforeLines" => {
|
"beforeLines" => {
|
||||||
spacing = spacing.before_lines(u32::from_str(&a.value)?);
|
spacing = spacing.before_lines(f64::from_str(&a.value)? as u32);
|
||||||
}
|
}
|
||||||
"afterLines" => {
|
"afterLines" => {
|
||||||
spacing = spacing.after_lines(u32::from_str(&a.value)?);
|
spacing = spacing.after_lines(f64::from_str(&a.value)? as u32);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ fn read_position_h<R: Read>(
|
||||||
let e = r.next();
|
let e = r.next();
|
||||||
match e {
|
match e {
|
||||||
Ok(XmlEvent::Characters(c)) => {
|
Ok(XmlEvent::Characters(c)) => {
|
||||||
if let Ok(p) = i32::from_str(&c) {
|
if let Ok(p) = f64::from_str(&c) {
|
||||||
offset = p;
|
offset = p as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(XmlEvent::EndElement { name, .. }) => {
|
Ok(XmlEvent::EndElement { name, .. }) => {
|
||||||
|
@ -59,8 +59,8 @@ fn read_position_v<R: Read>(
|
||||||
let e = r.next();
|
let e = r.next();
|
||||||
match e {
|
match e {
|
||||||
Ok(XmlEvent::Characters(c)) => {
|
Ok(XmlEvent::Characters(c)) => {
|
||||||
if let Ok(p) = i32::from_str(&c) {
|
if let Ok(p) = f64::from_str(&c) {
|
||||||
offset = p;
|
offset = p as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(XmlEvent::EndElement { name, .. }) => {
|
Ok(XmlEvent::EndElement { name, .. }) => {
|
||||||
|
@ -153,23 +153,23 @@ impl ElementReader for Drawing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distT") {
|
if let Some(d) = read(&attributes, "distT") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_t = d;
|
dist_t = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distB") {
|
if let Some(d) = read(&attributes, "distB") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_b = d;
|
dist_b = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distL") {
|
if let Some(d) = read(&attributes, "distL") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_l = d;
|
dist_l = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distR") {
|
if let Some(d) = read(&attributes, "distR") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_r = d;
|
dist_r = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "layoutInCell") {
|
if let Some(d) = read(&attributes, "layoutInCell") {
|
||||||
|
@ -178,8 +178,8 @@ impl ElementReader for Drawing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "relativeHeight") {
|
if let Some(d) = read(&attributes, "relativeHeight") {
|
||||||
if let Ok(d) = u32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
relative_height = d;
|
relative_height = d as u32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "allowOverlap") {
|
if let Some(d) = read(&attributes, "allowOverlap") {
|
||||||
|
@ -191,18 +191,18 @@ impl ElementReader for Drawing {
|
||||||
WpXMLElement::Inline => {
|
WpXMLElement::Inline => {
|
||||||
drawing_position_type = DrawingPositionType::Inline;
|
drawing_position_type = DrawingPositionType::Inline;
|
||||||
if let Some(d) = read(&attributes, "distT") {
|
if let Some(d) = read(&attributes, "distT") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_t = d;
|
dist_t = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distB") {
|
if let Some(d) = read(&attributes, "distB") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_b = d;
|
dist_b = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distL") {
|
if let Some(d) = read(&attributes, "distL") {
|
||||||
if let Ok(d) = i32::from_str(&d) {
|
if let Ok(d) = f64::from_str(&d) {
|
||||||
dist_l = d;
|
dist_l = d as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(d) = read(&attributes, "distR") {
|
if let Some(d) = read(&attributes, "distR") {
|
||||||
|
@ -213,13 +213,13 @@ impl ElementReader for Drawing {
|
||||||
}
|
}
|
||||||
WpXMLElement::SimplePos => {
|
WpXMLElement::SimplePos => {
|
||||||
if let Some(x) = read(&attributes, "x") {
|
if let Some(x) = read(&attributes, "x") {
|
||||||
if let Ok(x) = i32::from_str(&x) {
|
if let Ok(x) = f64::from_str(&x) {
|
||||||
simple_pos_x = x;
|
simple_pos_x = x as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(y) = read(&attributes, "y") {
|
if let Some(y) = read(&attributes, "y") {
|
||||||
if let Ok(y) = i32::from_str(&y) {
|
if let Ok(y) = f64::from_str(&y) {
|
||||||
simple_pos_y = y;
|
simple_pos_y = y as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ impl ElementReader for Pic {
|
||||||
let mut offset_x: i32 = 0;
|
let mut offset_x: i32 = 0;
|
||||||
let mut offset_y: i32 = 0;
|
let mut offset_y: i32 = 0;
|
||||||
if let Some(x) = read(&attributes, "x") {
|
if let Some(x) = read(&attributes, "x") {
|
||||||
if let Ok(x) = i32::from_str(&x) {
|
if let Ok(x) = f64::from_str(&x) {
|
||||||
offset_x = x;
|
offset_x = x as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(y) = read(&attributes, "y") {
|
if let Some(y) = read(&attributes, "y") {
|
||||||
if let Ok(y) = i32::from_str(&y) {
|
if let Ok(y) = f64::from_str(&y) {
|
||||||
offset_y = y;
|
offset_y = y as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pic = pic.offset_x(offset_x).offset_y(offset_y);
|
pic = pic.offset_x(offset_x).offset_y(offset_y);
|
||||||
|
|
|
@ -86,11 +86,13 @@ impl ElementReader for RunProperty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XMLElement::Color => rp = rp.color(attributes[0].value.clone()),
|
XMLElement::Color => rp = rp.color(attributes[0].value.clone()),
|
||||||
XMLElement::Size => rp = rp.size(usize::from_str(&attributes[0].value)?),
|
XMLElement::Size => {
|
||||||
|
rp = rp.size(f64::from_str(&attributes[0].value)? as usize)
|
||||||
|
}
|
||||||
XMLElement::Spacing => {
|
XMLElement::Spacing => {
|
||||||
if let Some(v) = read_val(&attributes) {
|
if let Some(v) = read_val(&attributes) {
|
||||||
if let Ok(s) = i32::from_str(&v) {
|
if let Ok(s) = f64::from_str(&v) {
|
||||||
rp = rp.spacing(s)
|
rp = rp.spacing(s as i32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docx-wasm",
|
"name": "docx-wasm",
|
||||||
"version": "0.0.278-rc15",
|
"version": "0.0.278-rc16",
|
||||||
"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>",
|
||||||
|
|
Loading…
Reference in New Issue