Skip to content

ODS: pictures anchored to the sheet are dropped #4677

Closed

Description

@usmanmateen

Bug

Pictures anchored to an ODS sheet (stored in <table:shapes>) are dropped. The conversion reports SUCCESS, and the only trace is a debug log:

Could not extract image from ODS sheet: 'DrawImage' object has no attribute 'get_data'

Pictures anchored to a cell are kept, because the rich cell path adds them.

OdsDocumentBackend._find_images_in_sheet reads each picture with img.get_data(), but odfdo's DrawImage has no get_data() (checked in odfdo 3.22.0 and 3.26.3), so the call raises for every picture and the except hides it.

#4557 changed this function, but it was merged into a stacked branch that didn't reach main (#4553 was closed), so main still has the get_data() call.

Steps to reproduce

from odfdo import Document, Element, Frame, Table
from PIL import Image

from docling.document_converter import DocumentConverter

Image.new("RGB", (200, 100), "red").save("red.png")

doc = Document("spreadsheet")
doc.body.clear()
table = Table("Sheet1", width=2, height=2)
doc.body.append(table)

# A picture anchored to cell B2
cell = table.get_cell("B2")
cell.append(Frame.image_frame(doc.add_file("red.png"), size=("2cm", "1cm")))
table.set_cell("B2", cell)

# A picture anchored to the sheet, stored in <table:shapes>
shapes = Element.from_tag("table:shapes")
shapes.append(
    Frame.image_frame(doc.add_file("red.png"), size=("2cm", "1cm"), position=("1cm", "1cm"))
)
table.insert(shapes, position=0)
doc.save("pictures.ods")

result = DocumentConverter().convert("pictures.ods")
print(result.status, len(result.document.pictures))  # ConversionStatus.SUCCESS 1, expected 2

Docling version

main at 9590eb4 (the code is the same in 2.135.0)

Python version

Python 3.12.13

I found this while working on #4666 and have a fix with tests, PR coming.

Activity

  1. added a commit that references this issue on Oct 14, 2026
    f3eda5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions