Skip to content

Update table_width.rs#722

Merged
bokuweb merged 3 commits intobokuweb:mainfrom
hackers267:main
Jul 14, 2024
Merged

Update table_width.rs#722
bokuweb merged 3 commits intobokuweb:mainfrom
hackers267:main

Conversation

@hackers267
Copy link
Contributor

fix the error when build the xml, the width_type is fixed, not pick from the TableWith

What does this change?

Change the fixed WidthType::Dxa to the self.width_type, so let the defined width is useful

References

Screenshots

What can I check for bug fixes?

Use the code to genrerate a docx:

use docx_rs::*;

pub fn main() -> Result<(), DocxError> {
    let path = std::path::Path::new("./table.docx");
    let file = std::fs::File::create(path).unwrap();

    let table = Table::new(vec![TableRow::new(vec![
        TableCell::new().add_paragraph(Paragraph::new())
    ])]).width(5000, WidthType::Pct);
    Docx::new().add_table(table).build().pack(file)?;
    Ok(())
}

then to unzip the table.docx, and check the tblW property's type is pct.

fix the error when build the xml, the width_type is fixed, not pick from the TableWith
@hackers267
Copy link
Contributor Author

What's the reason that can't be merged?

@bokuweb
Copy link
Owner

bokuweb commented Jul 14, 2024

sorry, i'm busy.i'll check.

@bokuweb bokuweb merged commit 79147fc into bokuweb:main Jul 14, 2024
@bokuweb
Copy link
Owner

bokuweb commented Jul 14, 2024

LGTM thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants