bokuweb / docx-rs

:memo: A .docx file writer with Rust/WebAssembly.
https://bokuweb.github.io/docx-rs/
MIT License
334 stars 57 forks source link

Floating images cause docx generation to fail with error `should end: LastElementNameNotAvailable` #686

Closed caelwarner closed 4 months ago

caelwarner commented 5 months ago

Describe the bug

Adding a picture with the position_type set to DrawingPositionType::Anchor causes the docx generation to fail with the error should end: LastElementNameNotAvailable. This error is currently reproducible with the image_floating example.

Reproduced step

  1. Run the image_floating example with cargo run --example image_floating
  2. Watch as the example panics with the error should end: LastElementNameNotAvailable

Expected behavior

The example not to panic

Actual behavior

The example panics with the message thread 'main' panicked at 'should end: LastElementNameNotAvailable', docx-core\src\xml_builder\mod.rs:119:14

Desktop

bokuweb commented 5 months ago

@caelwarner Thanks for your report. I'll do some investigation