Skip to content

OdfTableCellRange() is unusably slow for spreadsheets with whole-sheet formatting #285

@Nnnes

Description

@Nnnes

This issue is very closely related to #64. A fix for that issue would most likely also fix this one. The root problem is how LibreOffice handles setting formatting for an entire spreadsheet and how this library interacts with such spreadsheets.

Steps to reproduce:

  1. Create a new spreadsheet document in LibreOffice Calc
  2. Select all cells (Ctrl-A, or click to the left of the column letter list)
  3. Set any kind of formatting (e.g. change the font)
  4. Save

This creates a content.xml with the following inner content:

<table:table-column table:style-name="co1" table:number-columns-repeated="16384" table:default-cell-style-name="ce1" />
<table:table-row table:style-name="ro1" table:number-rows-repeated="1048575">
    <table:table-cell table:number-columns-repeated="16384" />
</table:table-row>
<table:table-row table:style-name="ro1">
    <table:table-cell table:number-columns-repeated="16384" />
</table:table-row>

getColumnCount() and getRowCount() then respectively return 16384 and 1048576. This is a problem for functions like getCellRangeByName(...) and getCellRangeByPosition(...) that eventually call getCellCoverInfos(), which will then attempt to iterate over every cell in the table multiple times.

It might be possible to fix this by patching getOwnerCellByPosition() without having to deal with the spreadsheet size issue. I'll try to do so and submit a pull request if I can figure out what a covered cell is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions