fix: chaespace type (#498)

Co-authored-by: bokuweb <bokuweb@bokuwebnombp.lan>
main
bokuweb 2022-06-15 23:43:19 +09:00 committed by GitHub
parent f08cefff0a
commit be3e5a9860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ use crate::xml_builder::*;
pub struct DocGrid { pub struct DocGrid {
grid_type: DocGridType, grid_type: DocGridType,
line_pitch: Option<usize>, line_pitch: Option<usize>,
char_space: Option<usize>, char_space: Option<isize>,
} }
impl DocGrid { impl DocGrid {
@ -35,7 +35,7 @@ impl DocGrid {
self self
} }
pub fn char_space(mut self, char_space: usize) -> Self { pub fn char_space(mut self, char_space: isize) -> Self {
self.char_space = Some(char_space); self.char_space = Some(char_space);
self self
} }

View File

@ -23,7 +23,7 @@ impl ElementReader for DocGrid {
doc_grid = doc_grid.line_pitch(line_pitch as usize); doc_grid = doc_grid.line_pitch(line_pitch as usize);
} else if local_name == "charSpace" { } else if local_name == "charSpace" {
let char_space = f32::from_str(&a.value)?; let char_space = f32::from_str(&a.value)?;
doc_grid = doc_grid.char_space(char_space as usize); doc_grid = doc_grid.char_space(char_space as isize);
} }
} }
Ok(doc_grid) Ok(doc_grid)

View File

@ -529,7 +529,7 @@ impl XMLBuilder {
mut self, mut self,
t: &DocGridType, t: &DocGridType,
line_pitch: Option<usize>, line_pitch: Option<usize>,
char_space: Option<usize>, char_space: Option<isize>,
) -> Self { ) -> Self {
let t = t.to_string(); let t = t.to_string();
let line_pitch_string = format!("{}", line_pitch.unwrap_or_default()); let line_pitch_string = format!("{}", line_pitch.unwrap_or_default());

View File

@ -162,7 +162,7 @@ impl Docx {
mut self, mut self,
grid_type: docx_rs::DocGridType, grid_type: docx_rs::DocGridType,
line_pitch: Option<usize>, line_pitch: Option<usize>,
char_space: Option<usize>, char_space: Option<isize>,
) -> Self { ) -> Self {
let mut doc_grid = docx_rs::DocGrid::with_empty().grid_type(grid_type); let mut doc_grid = docx_rs::DocGrid::with_empty().grid_type(grid_type);
if let Some(line_pitch) = line_pitch { if let Some(line_pitch) = line_pitch {