Closed gjblajian closed 8 months ago
@bokuweb could you please look into this? Thank you.
@gjblajian Sorry for late. I'm busy now... I'll improve it.
Images in headers (and probably footers) are also broken when created programmatically
use docx_rs::{Docx, Header, Paragraph, Pic, Run};
use std::{error::Error, io::Cursor};
fn main() -> Result<(), Box<dyn Error>> {
let cat = Pic::new(include_bytes!("cat_min.jpg"));
let header =
Header::new().add_paragraph(Paragraph::new().add_run(Run::new().add_image(cat.clone())));
let mut out = Vec::new();
let docx = Docx::new()
.header(header)
.add_paragraph(Paragraph::new().add_run(Run::new().add_image(cat)));
docx.build().pack(Cursor::new(&mut out))?;
std::fs::write("/tmp/out.docx", &out)?;
Ok(())
}
Describe the bug
When an image is in the header or footer the image is not present in the JSON of readDocx()
Reproduced step
Steps to reproduce the behavior:
Expected behavior
All images should be referenced in the JSON output of readDocx regardless of position in the document
Actual behavior
Image is not present when it is in the header or footer
Screenshots
N/A
Desktop (please complete the following information)
N/A