Skip to content

odf.element.Node.__str__ includes annotation text in the node contents. #146

@detrout

Description

@detrout

Hello,

I had a odt spreadsheet downloaded from google docs where the user had included some comments on some of the cells.

I extracted one of the cells that I was having problems iwth and replaced some of the text strings to be less internal project specific.

Given a cell like this:

<table:table-cell xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:ns42="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" table:style-name="ce1969" office:value-type="string" ns42:value-type="string">
  <office:annotation draw:style-name="gr3" draw:text-style-name="P2" svg:width="95.57mm" svg:height="15.08mm" svg:x="38.52mm" svg:y="1388.3mm" draw:caption-point-x="-4.07mm" draw:caption-point-y="-8.1mm">
    <dc:date>2025-05-12T00:00:00</dc:date>
    <text:p text:style-name="P1">
      <text:span text:style-name="T1">On Day2, did thing.</text:span>
    </text:p>
    <text:p text:style-name="P1">
      <text:span text:style-name="T1">
        <text:tab/>
      </text:span>
      <text:span text:style-name="T1">-Commenter</text:span>
    </text:p>
  </office:annotation>
<text:p>Cell Value</text:p></table:table-cell>

str() was returning text like "2025-05-12T00:00:00OnDay2, did thing.-CommenterCell Value"

I'd really like a way to get just the cell contents and ignore the comment. Ideally there'd be separate functions for accessing the annotation and cell value.

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