Commit Graph
183 Commits
Author SHA1 Message Date
Brandon Thomas b77848ee21 Merge pull request #1882 from neilcawse:fix/pivot-grand-totals
# Conflicts:
#	docs/file-format-parity.md
2026-10-19 12:22:07 -04:00
Brandon Thomas 06a94d42b2 Merge pull request #1935 from Mouhand-Kaddo:fix/shape-text-rtl
# Conflicts:
#	docs/file-format-parity.md
#	docs/localization-parity.md
2026-10-19 12:22:04 -04:00
Brandon Thomas 7b8aaf9ca7 Merge pull request #1939 from Mouhand-Kaddo:fix/xls-right-to-left-sheets
# Conflicts:
#	docs/file-format-parity.md
#	docs/localization-parity.md
2026-10-19 12:22:02 -04:00
Brandon Thomas a6757829eb Merge pull request #1814 from Higgs32584:fix-1447-pivot-bool-error-flags 2026-10-19 12:19:54 -04:00
Brandon Thomas 859e654dce Merge pull request #1923 from DrM7md:nux/clippy-1-95 2026-10-19 12:19:25 -04:00
Mouhand-Kaddo 7cd0a386aa M12.AR17: skip .xls dialog sheets instead of reading them as worksheets 2026-10-19 17:29:40 +04:00
Mouhand-Kaddo 59074fdc16 M12.AR9: open right-to-left sheets from .xls files right-to-left 2026-10-19 15:59:46 +04:00
Mouhand-Kaddo 90344445d7 M12.AR10: keep right-to-left paragraph direction in text boxes and shapes 2026-10-19 15:46:21 +04:00
MH 28cdf1d187 Fix two clippy lints new in Rust 1.95
CI installs the stable toolchain, and Rust 1.95's clippy fails
'cargo clippy --workspace --all-targets -- -D warnings' on main:

- xls/mod.rs: collapsible_match. The XF record's size check becomes a
  match guard; a full table still ignores the record (the catch-all arm).
- passthrough_tests.rs: nonminimal_bool. !is_some_and(x) is written as
  is_none_or(!x).

No change in behaviour.

Signed-off-by: MH <q6rrzz@gmail.com>
2026-10-19 13:08:41 +03:00
Neil Cawse 383bb7ba59 fix(xlsx): read and write PivotTable grand totals in Excel's direction
rowGrandTotals is the Grand Total row under the report and colGrandTotals the
Grand Total column at its right. Both were mapped the other way round; a
GridCraft round trip hid it, but an Excel file with only one grand total opened
with the other one.
2026-10-18 19:02:18 +00:00
Higgs32584andClaude Opus 5.5 c5a53a90ac #1447: booleans and errors count as strings in pivot cache flags
Excel counts TRUE/FALSE and error values as strings in a cache field's
<sharedItems>. GridCraft wrote containsString="0" (and counted booleans and
errors as separate kinds for containsMixedTypes) for such columns, which made
the file unopenable in Excel, even when the column wasn't used in the pivot.

Add Stats::strings() (text, booleans, errors) and use it for
containsSemiMixedTypes, containsString and containsMixedTypes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 21:41:43 -04:00
Nihilist NarwhalandClaude Opus 5.5 82ee02aac4 Formula parser: Excel's 8,192-character limit and postfix nesting (never crash) (#1330)
A hostile file could abort any process that opens it: a cell formula of a
million `%` (`1%%%…`) or a 200,000-term sum parsed into trees deep enough to
overflow the stack when printed, saved, evaluated or dropped, even in release
builds. Postfix operators (`%`, invoking a result) built their nesting in a
loop that the 256-level limit did not see.

- `parse` refuses formula text longer than Excel's 8,192 characters
  (`MAX_FORMULA_LEN`, counted in characters, the leading `=` excluded). This
  also bounds the depth of the left-deep trees long operator chains build.
- Each postfix `%` and each call of a result counts towards the nesting limit.
- A file's formula that is refused keeps its text and cached value, as other
  unparsable formulas do.

Regression tests: formula (small-stack thread: long `%`, invoke and operator
chains are errors; the limit counts characters, not bytes) and xlsx
(`hostile_formula_text_does_not_overflow_the_stack`: open, save and drop a
workbook with such formulas and a defined name on a 1 MiB stack). Both abort
with a stack overflow without the fix.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:39:28 -06:00
Brandon Thomas be003d44af Merge main into #863
# Conflicts:
#	crates/xlsx/src/tests/passthrough_tests.rs
2026-10-13 01:40:22 -04:00
Brandon ThomasandClaude Opus 5.5 8108dbccc6 Fix-up: close the passthrough tests the merges left open; rustfmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 01:21:57 -04:00
Brandon Thomas 0c488f79b3 Merge main into #809
# Conflicts:
#	ROADMAP.md
#	crates/numfmt/src/lib.rs
#	crates/numfmt/src/tests.rs
#	crates/xlsx/src/tests/malformed.rs
2026-10-13 01:04:29 -04:00
Brandon Thomas 9972a75f10 Merge main into #824
# Conflicts:
#	crates/engine/src/cmd/file.rs
#	crates/engine/src/tests.rs
#	crates/xlsx/src/tests/passthrough_tests.rs
2026-10-13 00:53:41 -04:00
Brandon Thomas 3c4556bb04 Merge main into #856
# Conflicts:
#	ROADMAP.md
#	crates/model/src/lib.rs
#	crates/xlsx/src/tests/passthrough_tests.rs
#	docs/file-format-parity.md
2026-10-13 00:52:57 -04:00
Brandon ThomasandClaude Opus 5.5 6405b00cf7 Fix-up: repair test files after merging the conflicting PRs
- restore closing braces the line-level merges of side-by-side tests dropped
- new ChartData literals carry the palette field
- the filter-menu shortcut passes the row with the column
- #688's tab tests account for #851's All Sheets button
- Serbian margins for the ruler-margin labels

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 00:34:01 -04:00
Marco Arnulfo c7cb91ea53 Merge remote-tracking branch 'origin/main' into fix/xlsx-xml-maps 2026-10-13 06:33:03 +02:00
Brandon Thomas 94ee7efdf9 Merge main into #853
# Conflicts:
#	ROADMAP.md
#	docs/file-format-parity.md
2026-10-13 00:08:58 -04:00
Brandon Thomas b2e2df3fc9 Merge main into #825
# Conflicts:
#	crates/xlsx/src/tests/xls_tests.rs
2026-10-13 00:08:49 -04:00
Brandon Thomas 62b7ba1e49 Merge main into #823
# Conflicts:
#	crates/xlsx/src/tests/roundtrip.rs
2026-10-13 00:08:44 -04:00
Brandon Thomas 6b28a97f63 Merge main into #747
# Conflicts:
#	crates/xlsx/src/tests/xls_tests.rs
#	docs/file-format-parity.md
2026-10-13 00:07:57 -04:00
Brandon Thomas 29775397ef Merge main into #712
# Conflicts:
#	ROADMAP.md
#	crates/xlsx/src/tests/mod.rs
#	docs/file-format-parity.md
#	docs/gaps.md
2026-10-13 00:07:50 -04:00
Brandon Thomas 6a3b462176 Merge main into #610
# Conflicts:
#	crates/xlsx/src/tests/roundtrip.rs
2026-10-13 00:07:26 -04:00
Brandon Thomas ad11eb3109 Merge main into #460
# Conflicts:
#	docs/file-format-parity.md
2026-10-13 00:07:10 -04:00
Brandon Thomas d14269a001 Merge pull request #869 from marcoarnulfo:fix/this-row-structured-refs 2026-10-12 23:50:09 -04:00
Brandon Thomas efed7caa01 Merge pull request #826 from marcoarnulfo:fix/xlsx-external-file-hyperlinks 2026-10-12 23:49:53 -04:00
Brandon Thomas a76759cba6 Merge pull request #822 from marcoarnulfo:fix/workbook-fileversion-calcfeatures 2026-10-12 23:49:47 -04:00
Brandon Thomas c9b36de54c Merge pull request #821 from marcoarnulfo:fix/xls-kept-value-string-result 2026-10-12 23:49:45 -04:00
Brandon Thomas d8561a9ed7 Merge pull request #755 from marcoarnulfo:fix/xludf-prefix 2026-10-12 23:49:23 -04:00
Brandon Thomas 83e9314835 Merge pull request #748 from marcoarnulfo:fix/cfb-short-last-sector 2026-10-12 23:49:16 -04:00
Brandon Thomas 0837cbc44d Merge pull request #746 from marcoarnulfo:fix/xls-format-short-string 2026-10-12 23:49:13 -04:00
Brandon Thomas 98c85c6de4 Merge pull request #718 from neilcawse:fix/pivot-values-on-rows 2026-10-12 23:49:00 -04:00
Brandon Thomas 1bba0ba35c Merge pull request #644 from MarekSpodBiedry:issue-511 2026-10-12 23:48:32 -04:00
Brandon Thomas 91138569fa Merge pull request #643 from MarekSpodBiedry:issue-512 2026-10-12 23:48:30 -04:00
Brandon Thomas 9c4314b070 Merge pull request #642 from MarekSpodBiedry:issue-513 2026-10-12 23:48:29 -04:00
Brandon Thomas e5071f382b Merge pull request #637 from MarekSpodBiedry:issue-518 2026-10-12 23:21:59 -04:00
Brandon Thomas 1fa38e583e Merge pull request #636 from MarekSpodBiedry:issue-519 2026-10-12 23:21:58 -04:00
Brandon Thomas 4164ca557e Merge pull request #609 from MarekSpodBiedry:issue-552 2026-10-12 23:21:30 -04:00
Marco Arnulfo dab4aa5e79 XLSX: write this-row structured references as [[#This Row],[Col]] (fixes #864)
[@Col] is only Excel's display shorthand. Written verbatim into cell formulas and calculatedColumnFormula, it made Excel repair the file and drop the tables.
2026-10-13 02:58:56 +02:00
neilcawseandClaude Opus 5.5 317ec4388c XLS: array formulas fill their range on recalculation
A legacy array formula in a .xls file ({=FREQUENCY(...)}, {=TREND(...)}) is
stored as one ARRAY record plus a FORMULA record per cell of its range, each
with the cached result. The importer attached the formula to the anchor cell
but kept the cached values in the other cells as plain constants. On
recalculation the formula then found its range occupied and returned #SPILL!.
The .xlsx reader already drops those cached results; the .xls reader now does
the same once the formula is attached, and keeps the values when the formula
could not be imported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:52:03 -04:00
Marco Arnulfo 2dd832e2d5 XLSX: XML maps survive a save, with their table columns and mapped cells (part of #860) 2026-10-13 02:45:40 +02:00
NetterSilver c5c1763774 XLSX: keep chart sheets on open and save (#727)
Chart sheets (a sheet that holds one chart; Move Chart > New sheet, F11) were
skipped on open, and their chart sheet, drawing, chart, style and colour parts
were dropped with them because the pass-through treats those kinds as content
GridCraft rewrites. Saving a workbook lost every chart sheet.

They are now kept as they were: the <sheet> entry (name, visibility and its
place among the worksheets), the chartsheet part and everything behind it,
byte for byte, written back in place. The workbook's other sheet positions
(active tab, print areas, scoped names) are computed with the chart sheets
counted. A chart sheet is left out on save when the chart is no longer
valid for the workbook: a sheet it plots was deleted or renamed, or a
worksheet took its name.
2026-10-13 01:45:40 +02:00
NetterSilver 39b3d55f8a CSV export: refuse a file over 512 MiB instead of expanding the whole used range (#528)
write_csv visited every position of the used range and appended to one growing
String with no limit, so two cells far apart (A1 and XFD1048576) asked for
about 16 GiB of commas. The output is now capped at 512 MiB: a lower bound
(delimiters and line ends of every row) is checked before anything is
allocated, and the text written so far is checked after each row. Over the
cap, write_csv returns IoError::TooLarge naming the rows, columns and limit,
and Save As / Export CSV and TSV report it without writing a file. Accepted
exports are unchanged. write_csv now returns a Result.
2026-10-13 01:16:05 +02:00
Marco Arnulfo 52b4f873c7 XLSX: a hyperlink to another file is saved as an external relationship (fixes #800) 2026-10-12 22:57:20 +02:00
Marco Arnulfo 484612f638 XLS: formulas that use a skipped defined name keep their saved results (fixes #803) 2026-10-12 22:56:40 +02:00
Marco Arnulfo 5406fc5629 XLSX: Save As into another folder keeps links on the same workbook (fixes #801)
Excel stores the path of a linked workbook relative to the file that uses it, and rewrites it when the file is saved into another folder. The path was kept as text, so after Save As it named a file next to the new copy: a missing link, or another workbook with the same name. Relative externalLinkPath targets are now resolved against the folder the workbook was read from and written relative to the folder it is saved into (absolute when there is no relative path, on another drive).
2026-10-12 22:55:53 +02:00
Marco Arnulfo 75305dfedf XLSX: keep the workbook's default font on save (fixes #805)
Cell format 0 always mapped to the model's built-in Calibri 11 default, so the file's Normal font was replaced on save and every default-formatted cell changed size. The Normal style now takes the font of cell format 0, and a Normal font in the theme's body face is written with scheme="minor" again.
2026-10-12 22:51:41 +02:00
Marco Arnulfo 930fa1cada XLSX: keep fileVersion and calcFeatures in workbook.xml on save (fixes #799)
Excel uses the cached cell values of a saved file only when workbook.xml has both <fileVersion> and the calcFeatures extension; without them it recalculates everything on open, and lookups into closed workbooks come back as #CALC!. Both are now read into the workbook's kept content and written back in schema order: fileVersion first, the calcFeatures ext in <extLst> last. A workbook that had neither gets neither.
2026-10-12 22:49:34 +02:00