Open jymchng opened 1 year ago
docx_rs::read_docx reading a .docx file with images should return Docx struct with non-empty RunChild::Drawing variant with Drawing.Pic.image to be a non-empty vector but it doesn't.
docx_rs::read_docx
.docx
Docx
RunChild::Drawing
Drawing.Pic.image
Steps to reproduce the behavior:
fn read_to_vec(file_name: &PathBuf) -> anyhow::Result<Vec<u8>> { let mut buf: Vec<u8> = Vec::new(); std::fs::File::open(file_name)?.read_to_end(&mut buf)?; Ok(buf) } let mut original_docx = docx_rs::read_docx(&read_to_vec(&path)?)?; dbg!(&original_docx);
The dbg!(&original_docx); should print out something that indicates that RunChild::Drawing variant with Drawing.Pic.image is a non-empty vector.
dbg!(&original_docx);
Instead, it prints out this:
children: [ Drawing( Drawing { data: Some( Pic( Pic { id: "rId5", image: [], size: ( 679639, 679639, ), position_type: Inline, simple_pos: false, simple_pos_x: 0, simple_pos_y: 0, layout_in_cell: true, relative_height: 0, allow_overlap: true, position_h: Offset( 0, ), position_v: Offset( 0, ), relative_from_h: Margin, relative_from_v: Margin, dist_t: 0, dist_b: 0, dist_l: 0, dist_r: 0, rot: 0, }, ), ), }, ), ]
This indicates that indeed, the images are not read.
Screenshot of original .docx file
Describe the bug
docx_rs::read_docx
reading a.docx
file with images should returnDocx
struct with non-emptyRunChild::Drawing
variant withDrawing.Pic.image
to be a non-empty vector but it doesn't.Reproduced step
Steps to reproduce the behavior:
Expected behavior
The
dbg!(&original_docx);
should print out something that indicates thatRunChild::Drawing
variant withDrawing.Pic.image
is a non-empty vector.Actual behavior
Instead, it prints out this:
This indicates that indeed, the images are not read.
Screenshots
Screenshot of original
.docx
fileDesktop (please complete the following information)