From fd664055dfd97d4b05b1e242515892fa4b7d7429 Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 11 Nov 2026 09:19:20 +0000 Subject: [PATCH 1/6] Fonts: outlined letters kept through XLSX open and save An XLSX font's was never read, so outlined (hollow) letters came back solid after a save. The model's Font gains `outline` (serde default false, left out of JSON when off, part of the hand-written Hash), read in read_font and written by font_xml after as Excel orders it, for cell fonts and differential formats. home.formatCells sets it through the style JSON. GridCraft does not draw outlined text yet. Split out of the ODS branch, which also maps style:text-outline onto it. --- crates/engine/src/cmd/format.rs | 12 ++++++++++++ crates/model/src/style.rs | 24 +++++++++++++++++++++++- crates/xlsx/src/styles.rs | 6 ++++++ crates/xlsx/src/tests/fixtures.rs | 25 +++++++++++++++++++++++++ crates/xlsx/src/tests/roundtrip.rs | 27 +++++++++++++++++++++++++++ docs/file-format-parity.md | 3 ++- 6 files changed, 95 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 1066f48e2..73861ebc6 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -870,6 +870,18 @@ mod tests { assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["num_fmt"], "0.00"); } + /// Outlined letters have no Font-group command; Format Cells' style JSON sets and clears them. + #[test] + fn format_cells_sets_outlined_letters() { + let mut s = crate::Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A1", "input": "x"})).unwrap(); + s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": true}}})).unwrap(); + assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"]["outline"], true); + s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": false}}})).unwrap(); + assert!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"].get("outline").is_none()); + } + #[test] fn width_units() { assert_eq!(chars_to_points(8.43), 64.0); diff --git a/crates/model/src/style.rs b/crates/model/src/style.rs index d2f10780e..9ade75ca2 100644 --- a/crates/model/src/style.rs +++ b/crates/model/src/style.rs @@ -197,6 +197,10 @@ pub struct Font { /// theme's minor font. Fonts derived from it (bold, a colour, a size) keep the link. #[serde(default = "default_minor")] pub minor: bool, + /// Outlined (hollow) letters: an XLSX ``. Kept and saved; GridCraft does not + /// draw it yet (the letters render solid). + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub outline: bool, } fn default_minor() -> bool { @@ -208,7 +212,7 @@ impl Hash for Font { fn hash(&self, h: &mut H) { self.name.hash(h); self.size.to_bits().hash(h); - (self.bold, self.italic, self.underline, self.strike, self.color, self.vert, self.charset, self.family, self.minor).hash(h); + (self.bold, self.italic, self.underline, self.strike, self.color, self.vert, self.charset, self.family, self.minor, self.outline).hash(h); } } @@ -226,6 +230,7 @@ impl Default for Font { charset: None, family: None, minor: true, + outline: false, } } } @@ -499,6 +504,23 @@ mod tests { assert!(!t.get(StyleId(999)).font.bold); } + /// Two fonts differing only in outlined letters are different styles; JSON leaves the + /// flag out when off, and JSON saved before it existed reads as not outlined. + #[test] + fn outline_makes_a_distinct_style() -> Result<(), Box> { + let mut t = StyleTable::default(); + let outlined = t.derive(StyleId::DEFAULT, |s| s.font.outline = true); + assert_ne!(outlined, StyleId::DEFAULT); + assert_ne!(Font { outline: true, ..Font::default() }, Font::default()); + assert_eq!(t.derive(outlined, |s| s.font.outline = false), StyleId::DEFAULT); + let json = serde_json::to_value(Font::default())?; + assert!(json.get("outline").is_none()); + assert_eq!(serde_json::from_value::(json)?, Font::default()); + let on = serde_json::to_value(Font { outline: true, ..Font::default() })?; + assert_eq!(on.get("outline"), Some(&serde_json::Value::Bool(true))); + Ok(()) + } + #[test] fn a_theme_saved_before_per_script_fonts_still_opens() -> Result<(), Box> { let mut json = serde_json::to_value(Theme::default())?; diff --git a/crates/xlsx/src/styles.rs b/crates/xlsx/src/styles.rs index c1f93aca9..d9229d1a8 100644 --- a/crates/xlsx/src/styles.rs +++ b/crates/xlsx/src/styles.rs @@ -71,6 +71,7 @@ pub fn read_font(e: &El, palette: &[u32]) -> Font { f.bold = bool_prop(e, "b"); f.italic = bool_prop(e, "i"); f.strike = bool_prop(e, "strike"); + f.outline = bool_prop(e, "outline"); if let Some(u) = e.child("u") { f.underline = match u.attr("val").unwrap_or("single") { "double" => Underline::Double, @@ -436,6 +437,10 @@ fn font_xml(f: &Font, dxf: Option<&DxfStated>, minor: bool) -> String { let _ = write!(s, "<{tag} val=\"0\"/>"); } } + // Excel's order puts outline after strike (condense and extend aren't modelled). + if f.outline { + s.push_str(""); + } match f.underline { Underline::None if stated.underline => s.push_str(""), Underline::None => {} @@ -709,6 +714,7 @@ pub fn write_styles(wb: &Workbook, dxfs: &[Style], extra_fmts: &[String]) -> (St if d.font.bold || d.font.italic || d.font.strike + || d.font.outline || d.font.underline != Underline::None || d.font.color != Color::Auto || d.font.vert != VertAlign::Baseline diff --git a/crates/xlsx/src/tests/fixtures.rs b/crates/xlsx/src/tests/fixtures.rs index 4de0be3c3..f0c57f851 100644 --- a/crates/xlsx/src/tests/fixtures.rs +++ b/crates/xlsx/src/tests/fixtures.rs @@ -236,6 +236,31 @@ fn dxf_font_and_parts_stated_at_their_defaults_survive_save() { assert_eq!(written, Some(format!(r#" count="4">{dxfs}"#).as_str())); } +/// A differential format whose only font part is outlined letters keeps it on save. +#[test] +fn dxf_outline_font_survives_save() { + let dxfs = r#""#; + let styles = format!( + r#" + + + + + {dxfs} + "# + ); + let rels = r#""#; + let body = r#"1 + 0"#; + let bytes = minimal(body, &[("xl/styles.xml", &styles)], rels, ""); + let (wb, _) = read_xlsx(&bytes).unwrap(); + let out = crate::write_xlsx(&wb).unwrap(); + let st = crate::package::Package::open(&out).unwrap().read("xl/styles.xml").unwrap().unwrap(); + let st = String::from_utf8(st).unwrap(); + let written = st.split_once("")).map(|(d, _)| d); + assert_eq!(written, Some(format!(r#" count="1">{dxfs}"#).as_str())); +} + /// A dxf writes its parts in schema order: the border comes before the protection. #[test] fn dxf_border_is_written_before_protection() { diff --git a/crates/xlsx/src/tests/roundtrip.rs b/crates/xlsx/src/tests/roundtrip.rs index 4eb6c3cfe..af9cb34bd 100644 --- a/crates/xlsx/src/tests/roundtrip.rs +++ b/crates/xlsx/src/tests/roundtrip.rs @@ -790,6 +790,33 @@ fn empty_workbook_roundtrip() { assert!(crate::sniff(&bytes) == crate::Format::Xlsx); } +/// Outlined (hollow) letters are kept on save and reopen, written after `` as Excel does; +/// `` reads as not outlined. +#[test] +fn outlined_font_survives_xlsx_roundtrip() { + let mut wb = Workbook::new(); + let outlined = wb.styles.derive(StyleId::DEFAULT, |s| { + s.font.outline = true; + s.font.strike = true; + }); + let sheet = wb.sheet_mut(0).unwrap(); + sheet.cells.set(at("A1"), Cell { value: Value::text("hollow"), formula: None, style: outlined, py: None }); + sheet.set_value(at("A2"), Value::text("solid")); + + let bytes = write_xlsx(&wb).unwrap(); + let styles = Package::open(&bytes).unwrap().read("xl/styles.xml").unwrap().unwrap(); + let styles = String::from_utf8(styles).unwrap(); + assert!(styles.contains(""), "{styles}"); + assert_eq!(styles.matches(""#).unwrap(), &[]).outline); +} + #[test] fn cell_text_carriage_returns_survive_xlsx_roundtrip() { let mut wb = Workbook::new(); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index d2660dde0..5090e9b4b 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File-format parity -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-03 · **Change:** minor (a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-11 · **Change:** minor (XLSX fonts keep outlined letters, ``, through open and save; GridCraft draws them solid; earlier: a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Every format Excel opens or saves, with GridCraft's read and write support, fidelity and tests. Part of [target-app-parity.md](target-app-parity.md). **File formats: ~50% ready, 80–120 h** @@ -158,6 +158,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here. | Date | Change | Summary | |---|---|---| +| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats; they were dropped before. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | | 2026-11-03 | minor | SYLK (`.slk`) import: values, R1C1 formulas as A1 (shared formulas too) with cached results, number formats and column widths; import only (#1481) | | 2026-11-03 | minor | Opening a web page (HTML) reads its first table as a sheet, whatever the file is called: a web app's "Export to Excel" saved as `.xls` no longer opens as lines of markup. Values read as in a CSV (or as text with `csvAsText`), `` cells are bold and centred, `` names the sheet, and a page not named `.htm`/`.html` opens with a warning (#3166) | | 2026-11-03 | minor | XLSX `` (Remove personal information from file properties on save) is read and written back, and while it is on GridCraft saves no author (`dc:creator`) and no company, as Excel leaves them empty (#3089, file part) | From ba605b4f69f77745caa5f5cc17f0ad0f84ce97b4 Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 11 Nov 2026 10:32:38 +0000 Subject: [PATCH 2/6] Fonts: a differential format's outline turned off survives save A dxf with read as unset and was saved without it, unlike bold, italic and strike, which keep their stated-off form. DxfStated gains `outline` (serde default, so older JSON opens), read in read_dxf and written by font_xml as . --- crates/model/src/style.rs | 6 ++++++ crates/xlsx/src/styles.rs | 4 ++++ crates/xlsx/src/tests/fixtures.rs | 12 +++++++----- docs/file-format-parity.md | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/crates/model/src/style.rs b/crates/model/src/style.rs index 9ade75ca2..6072fc3c3 100644 --- a/crates/model/src/style.rs +++ b/crates/model/src/style.rs @@ -402,6 +402,9 @@ pub struct DxfStated { pub bold: bool, pub italic: bool, pub strike: bool, + /// Outlined letters turned off (``). Defaulted so JSON saved before it opens. + #[serde(default)] + pub outline: bool, pub underline: bool, pub size: bool, pub name: bool, @@ -518,6 +521,9 @@ mod tests { assert_eq!(serde_json::from_value::(json)?, Font::default()); let on = serde_json::to_value(Font { outline: true, ..Font::default() })?; assert_eq!(on.get("outline"), Some(&serde_json::Value::Bool(true))); + let mut stated = serde_json::to_value(DxfStated::default())?; + assert!(stated.as_object_mut().ok_or("none")?.remove("outline").is_some()); + assert_eq!(serde_json::from_value::(stated)?, DxfStated::default()); Ok(()) } diff --git a/crates/xlsx/src/styles.rs b/crates/xlsx/src/styles.rs index d9229d1a8..8c55f7726 100644 --- a/crates/xlsx/src/styles.rs +++ b/crates/xlsx/src/styles.rs @@ -379,6 +379,7 @@ fn read_dxf(x: &El, palette: &[u32], fmts: &HashMap) -> Style { st.bold = e.child("b").is_some() && !f.bold; st.italic = e.child("i").is_some() && !f.italic; st.strike = e.child("strike").is_some() && !f.strike; + st.outline = e.child("outline").is_some() && !f.outline; st.underline = e.child("u").is_some() && f.underline == Underline::None; st.size = has_size && size == def.size; st.name = has_name && name == def.name; @@ -440,6 +441,8 @@ fn font_xml(f: &Font, dxf: Option<&DxfStated>, minor: bool) -> String { // Excel's order puts outline after strike (condense and extend aren't modelled). if f.outline { s.push_str(""); + } else if stated.outline { + s.push_str(""); } match f.underline { Underline::None if stated.underline => s.push_str(""), @@ -723,6 +726,7 @@ pub fn write_styles(wb: &Workbook, dxfs: &[Style], extra_fmts: &[String]) -> (St || st.bold || st.italic || st.strike + || st.outline || st.underline || st.size || st.name diff --git a/crates/xlsx/src/tests/fixtures.rs b/crates/xlsx/src/tests/fixtures.rs index f0c57f851..c138cf3eb 100644 --- a/crates/xlsx/src/tests/fixtures.rs +++ b/crates/xlsx/src/tests/fixtures.rs @@ -236,29 +236,31 @@ fn dxf_font_and_parts_stated_at_their_defaults_survive_save() { assert_eq!(written, Some(format!(r#" count="4">{dxfs}"#).as_str())); } -/// A differential format whose only font part is outlined letters keeps it on save. +/// A differential format whose only font part is outlined letters keeps it on save, turned on +/// or stated off (a conditional format turning the outline off), like strike. #[test] fn dxf_outline_font_survives_save() { - let dxfs = r#""#; + let dxfs = concat!(r#""#, r#""#); let styles = format!( r#" - {dxfs} + {dxfs} "# ); let rels = r#""#; let body = r#"1 - 0"#; + 0 + 0"#; let bytes = minimal(body, &[("xl/styles.xml", &styles)], rels, ""); let (wb, _) = read_xlsx(&bytes).unwrap(); let out = crate::write_xlsx(&wb).unwrap(); let st = crate::package::Package::open(&out).unwrap().read("xl/styles.xml").unwrap().unwrap(); let st = String::from_utf8(st).unwrap(); let written = st.split_once("")).map(|(d, _)| d); - assert_eq!(written, Some(format!(r#" count="1">{dxfs}"#).as_str())); + assert_eq!(written, Some(format!(r#" count="2">{dxfs}"#).as_str())); } /// A dxf writes its parts in schema order: the border comes before the protection. diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 5090e9b4b..b57459c2a 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -158,7 +158,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here. | Date | Change | Summary | |---|---|---| -| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats; they were dropped before. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | +| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats (a differential format that turns it off, ``, keeps that too); they were dropped before. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | | 2026-11-03 | minor | SYLK (`.slk`) import: values, R1C1 formulas as A1 (shared formulas too) with cached results, number formats and column widths; import only (#1481) | | 2026-11-03 | minor | Opening a web page (HTML) reads its first table as a sheet, whatever the file is called: a web app's "Export to Excel" saved as `.xls` no longer opens as lines of markup. Values read as in a CSV (or as text with `csvAsText`), `` cells are bold and centred, `` names the sheet, and a page not named `.htm`/`.html` opens with a warning (#3166) | | 2026-11-03 | minor | XLSX `` (Remove personal information from file properties on save) is read and written back, and while it is on GridCraft saves no author (`dc:creator`) and no company, as Excel leaves them empty (#3089, file part) | From 349fb760b15a35703b3139e26e24139f3e588ff2 Mon Sep 17 00:00:00 2001 From: alehel Date: Sat, 14 Nov 2026 01:51:24 +0100 Subject: [PATCH 3/6] Fonts: outline cleared through Format Cells, read from .xls, dxf gate tested Review round 1 on outlined letters: - Font::outline is now always serialized. The Format Cells dialog sends the active cell's whole style to the selection through home.formatCells, which merges JSON; with the field skipped when false, a plain active cell never cleared outline on the other selected cells, while bold and the rest were overwritten. Older JSON without the field still opens. - The legacy .xls reader reads the Font record's fOutline flag (0x0010), so an outlined .xls font no longer opens solid and is lost on save as .xlsx. - dxf_outline_font_survives_save gains a dxf whose only font part is , the case the write gate's st.outline term exists for. --- crates/engine/src/cmd/format.rs | 17 ++++++++++++++++- crates/model/src/style.rs | 14 ++++++++------ crates/xlsx/src/tests/fixtures.rs | 13 +++++++++---- crates/xlsx/src/tests/xls_style_tests.rs | 6 ++++-- crates/xlsx/src/xls/styles.rs | 1 + docs/file-format-parity.md | 4 ++-- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 73861ebc6..31a784f65 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -879,7 +879,22 @@ mod tests { s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": true}}})).unwrap(); assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"]["outline"], true); s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": false}}})).unwrap(); - assert!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"].get("outline").is_none()); + assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"]["outline"], false); + } + + /// The Format Cells dialog sends the active cell's whole style to every selected cell, so a + /// non-outlined active cell must clear outline on the others, as it does bold. + #[test] + fn format_cells_whole_style_clears_outline_on_the_selection() { + let mut s = crate::Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A1", "input": "plain"})).unwrap(); + s.execute("cell.set", json!({"cell": "B1", "input": "hollow"})).unwrap(); + s.execute("home.formatCells", json!({"range": "B1", "style": {"font": {"outline": true, "bold": true}}})).unwrap(); + let style = s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"].clone(); + s.execute("home.formatCells", json!({"range": "A1:B1", "style": style})).unwrap(); + let font = s.execute("cell.get", json!({"cell": "B1"})).unwrap()["style"]["font"].clone(); + assert_eq!((font["bold"].clone(), font["outline"].clone()), (json!(false), json!(false))); } #[test] diff --git a/crates/model/src/style.rs b/crates/model/src/style.rs index 6072fc3c3..02f117aa4 100644 --- a/crates/model/src/style.rs +++ b/crates/model/src/style.rs @@ -198,8 +198,9 @@ pub struct Font { #[serde(default = "default_minor")] pub minor: bool, /// Outlined (hollow) letters: an XLSX ``. Kept and saved; GridCraft does not - /// draw it yet (the letters render solid). - #[serde(default, skip_serializing_if = "std::ops::Not::not")] + /// draw it yet (the letters render solid). Always serialized, like the other flags, so a + /// whole style sent back through `home.formatCells` (the Format Cells dialog) clears it. + #[serde(default)] pub outline: bool, } @@ -507,8 +508,8 @@ mod tests { assert!(!t.get(StyleId(999)).font.bold); } - /// Two fonts differing only in outlined letters are different styles; JSON leaves the - /// flag out when off, and JSON saved before it existed reads as not outlined. + /// Two fonts differing only in outlined letters are different styles; JSON states the flag + /// even when off, and JSON saved before it existed reads as not outlined. #[test] fn outline_makes_a_distinct_style() -> Result<(), Box> { let mut t = StyleTable::default(); @@ -516,8 +517,9 @@ mod tests { assert_ne!(outlined, StyleId::DEFAULT); assert_ne!(Font { outline: true, ..Font::default() }, Font::default()); assert_eq!(t.derive(outlined, |s| s.font.outline = false), StyleId::DEFAULT); - let json = serde_json::to_value(Font::default())?; - assert!(json.get("outline").is_none()); + let mut json = serde_json::to_value(Font::default())?; + assert_eq!(json.get("outline"), Some(&serde_json::Value::Bool(false))); + assert!(json.as_object_mut().ok_or("none")?.remove("outline").is_some()); assert_eq!(serde_json::from_value::(json)?, Font::default()); let on = serde_json::to_value(Font { outline: true, ..Font::default() })?; assert_eq!(on.get("outline"), Some(&serde_json::Value::Bool(true))); diff --git a/crates/xlsx/src/tests/fixtures.rs b/crates/xlsx/src/tests/fixtures.rs index c138cf3eb..2b980dc84 100644 --- a/crates/xlsx/src/tests/fixtures.rs +++ b/crates/xlsx/src/tests/fixtures.rs @@ -240,27 +240,32 @@ fn dxf_font_and_parts_stated_at_their_defaults_survive_save() { /// or stated off (a conditional format turning the outline off), like strike. #[test] fn dxf_outline_font_survives_save() { - let dxfs = concat!(r#""#, r#""#); + let dxfs = concat!( + r#""#, + r#""#, + r#""#, + ); let styles = format!( r#" - {dxfs} + {dxfs} "# ); let rels = r#""#; let body = r#"1 0 - 0"#; + 0 + 0"#; let bytes = minimal(body, &[("xl/styles.xml", &styles)], rels, ""); let (wb, _) = read_xlsx(&bytes).unwrap(); let out = crate::write_xlsx(&wb).unwrap(); let st = crate::package::Package::open(&out).unwrap().read("xl/styles.xml").unwrap().unwrap(); let st = String::from_utf8(st).unwrap(); let written = st.split_once("")).map(|(d, _)| d); - assert_eq!(written, Some(format!(r#" count="2">{dxfs}"#).as_str())); + assert_eq!(written, Some(format!(r#" count="3">{dxfs}"#).as_str())); } /// A dxf writes its parts in schema order: the border comes before the protection. diff --git a/crates/xlsx/src/tests/xls_style_tests.rs b/crates/xlsx/src/tests/xls_style_tests.rs index 344cf37ed..47924b5af 100644 --- a/crates/xlsx/src/tests/xls_style_tests.rs +++ b/crates/xlsx/src/tests/xls_style_tests.rs @@ -134,7 +134,8 @@ fn formatted() -> Vec { let mut f = default_fonts(); // ifnt 5 (index 4 is never written): 14 pt italic, struck, bold, double underline, // superscript, red (colour 10). - f.push(font(280, 0x000A, 10, 700, 1, 2, "Courier New")); + // 0x001A: italic, strike and outline. + f.push(font(280, 0x001A, 10, 700, 1, 2, "Courier New")); // ifnt 6: single accounting underline, subscript, a custom palette colour. f.push(font(220, 0, 9, 400, 2, 0x21, "Times New Roman")); // Palette: the first two of the 56 custom entries (colour indexes 8 and 9) replaced. @@ -219,7 +220,7 @@ fn reads_primary_style(wb: &Workbook) { let s = style_at(wb, "A1"); let f = &s.font; assert_eq!((f.name.as_str(), f.size), ("Courier New", 14.0)); - assert!(f.bold && f.italic && f.strike); + assert!(f.bold && f.italic && f.strike && f.outline); assert_eq!((f.underline, f.vert, f.color), (Underline::Double, VertAlign::Superscript, Color::Rgb(0xFF0000))); assert_eq!(s.num_fmt.as_str(), "0.0%"); assert_eq!(s.protection, Protection { locked: false, hidden: true }); @@ -263,6 +264,7 @@ fn reads_cell_style_and_xlsx_roundtrip(wb: &Workbook) { let s = style_at(wb, "A6"); assert_eq!((s.font.name.as_str(), s.font.size, s.font.color), ("Times New Roman", 11.0, Color::Rgb(0xABCDEF))); assert_eq!((s.font.underline, s.font.vert), (Underline::SingleAccounting, VertAlign::Subscript)); + assert!(!s.font.outline, "a Font record without fOutline is not outlined"); // User-defined styles are kept (first of a name wins); built-in ones are GridCraft's own. assert_eq!(wb.cell_styles.len(), 1, "{:?}", wb.cell_styles.iter().map(|(n, _)| n).collect::>()); diff --git a/crates/xlsx/src/xls/styles.rs b/crates/xlsx/src/xls/styles.rs index cc7c496f2..2fc7c8133 100644 --- a/crates/xlsx/src/xls/styles.rs +++ b/crates/xlsx/src/xls/styles.rs @@ -197,6 +197,7 @@ fn read_font(c: &mut Cursor<'_, '_>) -> Option<(Font, u16)> { } f.italic = flags & 0x0002 != 0; f.strike = flags & 0x0008 != 0; + f.outline = flags & 0x0010 != 0; // Weights run 100-1000; Excel writes 400 for normal and 700 for bold. f.bold = weight >= 600; f.vert = match script { diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index b57459c2a..f435c72a2 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File-format parity -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-11 · **Change:** minor (XLSX fonts keep outlined letters, ``, through open and save; GridCraft draws them solid; earlier: a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-11 · **Change:** minor (XLSX fonts keep outlined letters, ``, through open and save, and `.xls` reads them; GridCraft draws them solid; earlier: a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Every format Excel opens or saves, with GridCraft's read and write support, fidelity and tests. Part of [target-app-parity.md](target-app-parity.md). **File formats: ~50% ready, 80–120 h** @@ -158,7 +158,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here. | Date | Change | Summary | |---|---|---| -| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats (a differential format that turns it off, ``, keeps that too); they were dropped before. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | +| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats (a differential format that turns it off, ``, keeps that too); they were dropped before. Legacy `.xls` Font records' fOutline flag (0x0010) reads as outlined too. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | | 2026-11-03 | minor | SYLK (`.slk`) import: values, R1C1 formulas as A1 (shared formulas too) with cached results, number formats and column widths; import only (#1481) | | 2026-11-03 | minor | Opening a web page (HTML) reads its first table as a sheet, whatever the file is called: a web app's "Export to Excel" saved as `.xls` no longer opens as lines of markup. Values read as in a CSV (or as text with `csvAsText`), `` cells are bold and centred, `` names the sheet, and a page not named `.htm`/`.html` opens with a warning (#3166) | | 2026-11-03 | minor | XLSX `` (Remove personal information from file properties on save) is read and written back, and while it is on GridCraft saves no author (`dc:creator`) and no company, as Excel leaves them empty (#3089, file part) | From 60ec576e0c3d8c60b0f497fb5f22e47e79408997 Mon Sep 17 00:00:00 2001 From: alehel Date: Sat, 14 Nov 2026 02:03:38 +0100 Subject: [PATCH 4/6] Fonts: outline test comments and docs dates brought up to date Review round 2 found no defects; this rewords the dxf fixture's doc comment (one dxf also states strike), folds the .xls fixture's outline flag into its description, and dates the docs row and timestamp line to the round-1 fixes. --- crates/xlsx/src/tests/fixtures.rs | 4 ++-- crates/xlsx/src/tests/xls_style_tests.rs | 5 ++--- docs/file-format-parity.md | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/xlsx/src/tests/fixtures.rs b/crates/xlsx/src/tests/fixtures.rs index 2b980dc84..bb6281917 100644 --- a/crates/xlsx/src/tests/fixtures.rs +++ b/crates/xlsx/src/tests/fixtures.rs @@ -236,8 +236,8 @@ fn dxf_font_and_parts_stated_at_their_defaults_survive_save() { assert_eq!(written, Some(format!(r#" count="4">{dxfs}"#).as_str())); } -/// A differential format whose only font part is outlined letters keeps it on save, turned on -/// or stated off (a conditional format turning the outline off), like strike. +/// Differential fonts that turn outlined letters on, or state them off (alone, or after strike), +/// keep it on save, like strike. #[test] fn dxf_outline_font_survives_save() { let dxfs = concat!( diff --git a/crates/xlsx/src/tests/xls_style_tests.rs b/crates/xlsx/src/tests/xls_style_tests.rs index 47924b5af..f120e7db0 100644 --- a/crates/xlsx/src/tests/xls_style_tests.rs +++ b/crates/xlsx/src/tests/xls_style_tests.rs @@ -132,9 +132,8 @@ fn default_fonts() -> Vec> { /// Fonts, a palette, style XFs, cell XFs and named styles covering every decoded field. fn formatted() -> Vec { let mut f = default_fonts(); - // ifnt 5 (index 4 is never written): 14 pt italic, struck, bold, double underline, - // superscript, red (colour 10). - // 0x001A: italic, strike and outline. + // ifnt 5 (index 4 is never written): 14 pt italic, struck, outlined (flags 0x001A), bold, + // double underline, superscript, red (colour 10). f.push(font(280, 0x001A, 10, 700, 1, 2, "Courier New")); // ifnt 6: single accounting underline, subscript, a custom palette colour. f.push(font(220, 0, 9, 400, 2, 0x21, "Times New Roman")); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index f435c72a2..f852bbaa1 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File-format parity -> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-11 · **Change:** minor (XLSX fonts keep outlined letters, ``, through open and save, and `.xls` reads them; GridCraft draws them solid; earlier: a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-11-01 · **Last updated:** 2026-11-14 · **Change:** minor (XLSX fonts keep outlined letters, ``, through open and save, and `.xls` reads them; GridCraft draws them solid; earlier: a web page's first table opens as a sheet, also when the page is named `.xls`; earlier: `workbookPr filterPrivacy` kept, and honoured on save; earlier: a workbook's R1C1 reference style, `calcPr refMode`, is kept through open and save; earlier: XLSX page margins are written as their decimals, `0.3` rather than `0.30000001192092896`; earlier: Python cells in `.xlsx` as [MS-XLSX] specifies, `_xlfn._xlws.PY(…)` naming code in the Python part, with cached values, and in GridCraft JSON, with limits on open; earlier: equations in xlsx as Office Math with a marker in `descr` so an edit made in Excel reads back, read back only up to the equation source cap, and a brace with a label and a script on its other side keeps both; Symbol font in PDF; earlier: XLSX reads and writes Page Setup's page order, `pageSetup pageOrder`, and PDF export follows it; earlier: chart data tables: native c:dTable import/export; earlier: XLSX workbook-view selection, normalized tab ratios and sheet-edit regressions; fidelity estimates unchanged; earlier: formulas from Google Sheets' XLSX export open as the original formula instead of `IFERROR(__xludf.DUMMYFUNCTION(…),…)` when GridCraft calculates every function in it, and save as it; `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; earlier: `file.exportCsv {values: true}` writes raw values for automation; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors; CSV and text open detects each column's date order from values that read only one way, warns when every date is ambiguous, and keeps a column with both kinds as text (#2765)) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Every format Excel opens or saves, with GridCraft's read and write support, fidelity and tests. Part of [target-app-parity.md](target-app-parity.md). **File formats: ~50% ready, 80–120 h** @@ -158,7 +158,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here. | Date | Change | Summary | |---|---|---| -| 2026-11-11 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats (a differential format that turns it off, ``, keeps that too); they were dropped before. Legacy `.xls` Font records' fOutline flag (0x0010) reads as outlined too. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | +| 2026-11-14 | minor | XLSX fonts' outlined (hollow) letters, ``, are read and written back after `` as Excel writes them, in cell fonts and differential formats (a differential format that turns it off, ``, keeps that too); they were dropped before. Legacy `.xls` Font records' fOutline flag (0x0010) reads as outlined too. Two fonts differing only in it are different styles. Set by `home.formatCells {style: {font: {outline: true}}}`; GridCraft does not draw outlined text yet (it shows solid) | | 2026-11-03 | minor | SYLK (`.slk`) import: values, R1C1 formulas as A1 (shared formulas too) with cached results, number formats and column widths; import only (#1481) | | 2026-11-03 | minor | Opening a web page (HTML) reads its first table as a sheet, whatever the file is called: a web app's "Export to Excel" saved as `.xls` no longer opens as lines of markup. Values read as in a CSV (or as text with `csvAsText`), `` cells are bold and centred, `` names the sheet, and a page not named `.htm`/`.html` opens with a warning (#3166) | | 2026-11-03 | minor | XLSX `` (Remove personal information from file properties on save) is read and written back, and while it is on GridCraft saves no author (`dc:creator`) and no company, as Excel leaves them empty (#3089, file part) | From 7d0f153f9d9e9c5f7f73709a69e3545acdaa4a99 Mon Sep 17 00:00:00 2001 From: alehel Date: Mon, 23 Nov 2026 11:58:53 +0100 Subject: [PATCH 5/6] json goldens: kept.json states "outline" too kept.json is built from book.json, so it is re-blessed after it. --- crates/engine/tests/golden/kept.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/engine/tests/golden/kept.json b/crates/engine/tests/golden/kept.json index 0cbc313cf..c1ecfe6f3 100644 --- a/crates/engine/tests/golden/kept.json +++ b/crates/engine/tests/golden/kept.json @@ -247,6 +247,7 @@ "bold": false, "italic": false, "name": false, + "outline": false, "protection": false, "scheme": null, "size": false, @@ -266,6 +267,7 @@ "italic": false, "minor": true, "name": "Calibri", + "outline": false, "size": 11.0, "strike": false, "underline": "None", @@ -317,6 +319,7 @@ "bold": false, "italic": false, "name": false, + "outline": false, "protection": false, "scheme": null, "size": false, @@ -336,6 +339,7 @@ "italic": false, "minor": true, "name": "Calibri", + "outline": false, "size": 11.0, "strike": false, "underline": "None", @@ -387,6 +391,7 @@ "bold": false, "italic": false, "name": false, + "outline": false, "protection": false, "scheme": null, "size": false, @@ -406,6 +411,7 @@ "italic": false, "minor": true, "name": "Calibri", + "outline": false, "size": 11.0, "strike": false, "underline": "None", From 8d6e207f040c6872e7c6c46170f185e3b5a36a95 Mon Sep 17 00:00:00 2001 From: alehel Date: Mon, 23 Nov 2026 13:59:05 +0100 Subject: [PATCH 6/6] xlsx: font outline goes through the shared craft-xlsx Font The outline flag is read with craft_xlsx::Font::read and written with craft_xlsx::Font::to_el, so its three states (absent, stated off, on) follow the shared SpreadsheetML handling instead of a second reader and writer here. The app keeps the mapping to Font::outline and DxfStated::outline. --- crates/xlsx/src/styles.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/crates/xlsx/src/styles.rs b/crates/xlsx/src/styles.rs index d006b2c93..2da082c61 100644 --- a/crates/xlsx/src/styles.rs +++ b/crates/xlsx/src/styles.rs @@ -61,6 +61,22 @@ fn bool_prop(e: &El, name: &str) -> bool { e.child(name).is_some_and(|c| c.flag("val", true)) } +/// A font's `outline` as the shared SpreadsheetML font (`craft-xlsx`) reads it: `None` when the +/// element is absent, `Some(false)` when it says `val="0"` (stated off, which a differential +/// format keeps), `Some(true)` when on. +fn shared_outline(e: &El) -> Option { + craft_xlsx::Font::read(&crate::chart::to_craft_el(e)).outline +} + +/// The shared SpreadsheetML font's `outline` element for `outline`, written as it writes it: +/// ``, ``, or nothing. +fn push_shared_outline(s: &mut String, outline: Option) { + let font = craft_xlsx::Font { outline, ..Default::default() }.to_el("font", false); + for child in font.elements() { + child.write_xml(s); + } +} + const DEFAULT_FONT_FAMILY: u8 = 2; const MAX_FONT_FAMILY: u8 = 14; @@ -79,7 +95,7 @@ pub fn read_font(e: &El, palette: &[u32]) -> Font { f.bold = bool_prop(e, "b"); f.italic = bool_prop(e, "i"); f.strike = bool_prop(e, "strike"); - f.outline = bool_prop(e, "outline"); + f.outline = shared_outline(e) == Some(true); if let Some(u) = e.child("u") { f.underline = match u.attr("val").unwrap_or("single") { "double" => Underline::Double, @@ -415,7 +431,7 @@ fn read_dxf<'a>(x: &'a El, palette: &[u32], fmts: &HashMap, inline_ st.bold = e.child("b").is_some() && !f.bold; st.italic = e.child("i").is_some() && !f.italic; st.strike = e.child("strike").is_some() && !f.strike; - st.outline = e.child("outline").is_some() && !f.outline; + st.outline = shared_outline(e) == Some(false); st.underline = e.child("u").is_some() && f.underline == Underline::None; st.size = has_size && size == def.size; st.name = has_name && name == def.name; @@ -483,11 +499,8 @@ fn font_xml(f: &Font, dxf: Option<&DxfStated>, minor: bool) -> String { } } // Excel's order puts outline after strike (condense and extend aren't modelled). - if f.outline { - s.push_str(""); - } else if stated.outline { - s.push_str(""); - } + let outline = if f.outline { Some(true) } else { stated.outline.then_some(false) }; + push_shared_outline(&mut s, outline); match f.underline { Underline::None if stated.underline => s.push_str(""), Underline::None => {}