Description: Assume I have an Excel file (XLSX) with a data sheet containing several rows with data only (e.g. 10 rows), when deleting one of these rows with data and save, then open the Excel file with MS Excel or PHPSpreadsheet library, using Excel hot key to go to the highest row or using the $sheet->getHighestRow() goes to the 1048576th row respectively BUT NOT the 9th row. This will cause some problem when processing the Excel with some software library, e.g. PHPSpreadsheet Steps to Reproduce: 1. open an Excel XLSX file with some rows with data 2. delete one of the data rows and save 3. open the resulting file with MS Excel or PHPSpreadsheet PHP programming library 4. press hotkey ([command]-[down arrow] x 2 times) for MS Excel or call $sheet->getHighestRow() when opening the Excel sheet using PHPSpreadsheet Actual Results: 1. in MS Excel, pressing [command]-[down arrow] x 2 times will go to the 1048576th row 2. the $sheet->getHighestRow() returns 1048576 Expected Results: 1. in MS Excel, pressing [command]-[down arrow] x 2 times should go to the last row with data 2. should return the last row with data Reproducible: Always User Profile Reset: No OpenGL enabled: Yes Additional Info: Version: 7.3.4.2 / LibreOffice Community Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5 CPU threads: 8; OS: Mac OS X 12.3; UI render: default; VCL: osx Locale: en-HK (en_HK.UTF-8); UI: en-US Calc: threaded
(In reply to Richard from comment #0) > Expected Results: > 1. in MS Excel, pressing [command]-[down arrow] x 2 times should go to the > last row with data No. The first press is expected to bring you to the last row of the current block; the second one should bring you to the end of the next block - or to the last physical spreadsheet row (1048576) if there's no blocks below. The behavior you describe is expected. > 2. should return the last row with data No. getHighestRow is not related to "rows with data" - unlike getHighestDataRow. See e.g. https://github.com/PHPOffice/PhpSpreadsheet/issues/2051 (which is basically the same issue). Deleting rows from a file created in Excel must append new rows to the bottom; the default row heights differ between Excel and Calc -> the appended rows are narrower than the rest, and that *formatting* is reflected in the markup (and is detected by PHPSpreadsheet, and reflected by getHighestRow). Eike: can we read the default row height from the file, or maybe clone formatting from the row above when appending new rows?
I think the default row height should simply be set when reading such file if it is available from there (or maybe differs by generator application, but going down that route is also doomed to fail).
Created attachment 181131 [details] Just a simple XLSX created with MS Excel 2016 (In reply to Eike Rathke from comment #2) <sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/> is present in the attached sample. So this could be turned into "defaultRowHeight attribute of sheetFormatPr is not read / not taken into account when adding rows after row removal".