docx-rs icon indicating copy to clipboard operation
docx-rs copied to clipboard

Table not working?

Open MarcoBelluDev opened this issue 7 months ago • 0 comments

Describe the bug

Hi all, I think this is more a problem of mine rather than a real bug. Anyhow, I am not able to get table working. I also tried to simply copy the example code (table.rs) from github but still no results.

Script used (table.rs)

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())
    ])]);
    Docx::new().add_table(table).build().pack(file)?;
    Ok(())
}

Expected behavior

Generated table.docx file contains a table.

Actual behavior

Generated table.docx file is completely empty.

Screenshots

Image

Desktop

  • OS: Windows 11
  • Version: docx-rs = "0.4.17"

MarcoBelluDev avatar Jun 05 '25 17:06 MarcoBelluDev