<table><tr><td style="">davidllewellynjones created this revision.<br />davidllewellynjones added reviewers: Calligra: 3.0, pvuorela, dcaliste.<br />davidllewellynjones added a project: Calligra: 3.0.<br />Herald added a subscriber: Calligra-Devel-list.<br />davidllewellynjones requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25008">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Loading large XLSX files on resource-constrained devices can be very slow, and the problem is made worse by the fact that spreadsheet applications make it easy to add styles to large numbers of rows and columns, even though the number of cells with actual content may be quite small (e.g. select a single entire column/row and apply a style). In this case it's much faster to only convert the cells inside the boundary containing values, and ignore the cells beyond this which only have styles applied.</p>
<p>This patch adds a number of compile-time defines that can be used to optimise loading of XLSX spreadsheet documents on restricted devices.</p>
<p>For the desktop version I expect none of these flags will be particularly interesting, so if they're not provided to cmake, the current behaviour is left unchanged.</p>
<p><tt style="background: #ebebeb; font-size: 13px;">MSOOXML_MAX_SPREADSHEET_COLS=<integer></tt></p>
<p>This controls the maximum number of columns that the importer will load. Any columns outside the range will be ignored. The default value is 0x7FFF, the maximum number of columns supported by Calligra.</p>
<p><tt style="background: #ebebeb; font-size: 13px;">MSOOXML_MAX_SPREADSHEET_ROWS=<integer></tt></p>
<p>This controls the maximum number of rows that the importer will load. Any rows outside the range will be ignored. The default value is 0xFFFFF, the maximum number of rows supported by Calligra.</p>
<p><tt style="background: #ebebeb; font-size: 13px;">MSOOXML_SPREADSHEET_CONTENT_BORDER=<integer></tt></p>
<p>If this value is set to a positive value, the importer will calculate the smallest spreadsheet size that can accommodate all cells containing values or formulae. It adds a border of the given number of cells and uses that for the maximum bounds of the imported spreadsheet. This can be useful because it's easy to create spreadsheets where large numbers of cells have style attributes set, but which in practice only have content in a smaller area of the spreadsheet. Setting this value therefore provides an optimised way to import the spreadsheet, but with style data lost outside of the bounded region.</p>
<p>If this value is left unset, or is negative, the full spreadsheet will be imported.</p>
<p><tt style="background: #ebebeb; font-size: 13px;">MSOOXML_IMPORT_READ_ONLY=<true|false></tt></p>
<p>Formula cells in XLSX documents store both the formula and the calculated value at the time the document was saved. When importing a file for read-only viewing, the value is more useful than the cell. By setting this flag, the importer can optimise by using the values rather than the formulae.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>The following example spreadsheet has data in columns IR (252) and IW (257):</p>
<p><a href="http://www.flypig.co.uk/dnload/dnload/other/calligra-optimise01.zip" class="remarkup-link" target="_blank" rel="noreferrer">http://www.flypig.co.uk/dnload/dnload/other/calligra-optimise01.zip</a></p>
<ol class="remarkup-list">
<li class="remarkup-list-item">Load the file and notice there's data in columns IR and IW.</li>
</ol>
<ol class="remarkup-list" start="2">
<li class="remarkup-list-item">Following the <a href="https://community.kde.org/Calligra/Building/3#Build_Calligra" class="remarkup-link" target="_blank" rel="noreferrer">standard instructions</a>, rebuild Calligra using the additional flags:</li>
</ol>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">cd ~/kde/src/calligra
cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde/inst5 $HOME/kde/src/calligra -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPRODUCTSET=SHEETS -DMSOOXML_MAX_SPREADSHEET_COLS=0xFF -DMSOOXML_MAX_SPREADSHEET_ROWS=0x1400 -DMSOOXML_SPREADSHEET_CONTENT_BORDER=5 -DMSOOXML_IMPORT_READ_ONLY=true
make -j6
make install -j6</pre></div>
<ol class="remarkup-list" start="3">
<li class="remarkup-list-item">Open the file with the newly build version of Calligra and notice that the less data has been loaded.</li>
</ol>
<p>Playing around with the file and different values for the flags should give a mixture of results.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R8 Calligra</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25008">https://phabricator.kde.org/D25008</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
filters/libmsooxml/MsooXmlGlobal.cpp<br />
filters/libmsooxml/MsooXmlGlobal.h<br />
filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp<br />
filters/sheets/xlsx/XlsxXmlWorksheetReader_p.h</div></div></div><br /><div><strong>To: </strong>davidllewellynjones, Calligra: 3.0, pvuorela, dcaliste<br /><strong>Cc: </strong>Calligra-Devel-list, davidllewellynjones, dcaliste, cochise, vandenoever<br /></div>