diff --git a/docx-core/src/documents/mod.rs b/docx-core/src/documents/mod.rs index 5b147c7..936852f 100644 --- a/docx-core/src/documents/mod.rs +++ b/docx-core/src/documents/mod.rs @@ -863,8 +863,12 @@ impl Docx { &mut image_bufs, ); } - TableCellContent::Table(_) => { - // TODO: support comment + TableCellContent::Table(table) => { + collect_images_from_table( + table, + &mut images, + &mut image_bufs, + ); } } } @@ -960,6 +964,27 @@ fn collect_images_from_paragraph( } } +fn collect_images_from_table( + table: &mut Table, + images: &mut Vec<(String, String)>, + image_bufs: &mut Vec<(String, Vec)>, +) { + for TableChild::TableRow(row) in &mut table.rows { + for TableRowChild::TableCell(cell) in &mut row.cells { + for content in &mut cell.children { + match content { + TableCellContent::Paragraph(paragraph) => { + collect_images_from_paragraph(paragraph, images, image_bufs); + } + TableCellContent::Table(table) => { + collect_images_from_table(table, images, image_bufs) + } + } + } + } + } +} + fn update_document_by_toc( document_children: Vec, styles: &Styles, diff --git a/docx-wasm/package.json b/docx-wasm/package.json index ea17483..f231e55 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.264", + "version": "0.0.265", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ",