Print: Print Selection in File > Print > Settings, several selected areas print one after the other (fixes #2351)

This commit is contained in:
Marco Arnulfo committed 2026-10-23 17:25:24 +02:00
1 parent f1e29fa828
commit db2fffa9be
24 files changed
+192 -33

No files matched your search

+2 -1
View File
@@ -2,7 +2,7 @@
**Stage: alpha** · next: beta, ~25 points of "ready for real work" and ~160–240 h away
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-22 · **Change:** trivial (progress log: formula hardening, #2163/#2162; previously minor: Page Setup paper sizes: JIS B4/B5/B6, the Japanese postcards and envelopes, and A6; long flat operator chains up to Excel's formula limit) · **Target:** Microsoft Excel (Microsoft 365)
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-23 · **Change:** minor (File › Print › Settings: Print Selection; previously: progress log: formula hardening, #2163/#2162; previously minor: Page Setup paper sizes: JIS B4/B5/B6, the Japanese postcards and envelopes, and A6; long flat operator chains up to Excel's formula limit) · **Target:** Microsoft Excel (Microsoft 365)
GridCraft aims at full Microsoft Excel parity, and at being better in places: faster, open (XLSX
is the native format), fully scriptable by agents (MCP, control channel, CLI), and on the web.
@@ -135,6 +135,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in
| Date | What landed |
|---|---|
| 2026-10-23 | File › Print › Settings offers Print Selection next to Print Active Sheets and Print Entire Workbook; several selected areas print one after the other, as in Excel |
| 2026-10-22 | Formula hardening: digits too many for a finite number are text, so `"1 <400 digits>/<400 digits>"` no longer coerces to NaN; a NaN column index in VLOOKUP, HLOOKUP and the D-functions is `#VALUE!` instead of an index underflow; REGEXREPLACE stops building a result as soon as it can only be too long (a worst case went from 1 GB to 7 MB) (#2163, #2162) |
| 2026-10-21 | Page Setup paper sizes match Japanese Excel: `B4`/`B5`/`B6` are the JIS sizes (ISO B4/B5/B6 stay reachable by name), so a Japanese B5 worksheet prints at 182×257 mm; Japanese Postcard (100×148 mm), Double Postcard (148×200 mm), Envelope #3/#4 (120×235/90×205 mm), Kaku #2/#3 (240×332/216×277 mm) and A6 are added, both sizes reach the PDF page (`file.exportPdf`/`file.print` MediaBox) and the size survives an XLSX round-trip; the Page Layout Size menu lists them. `B4`/`B5` used to be the ISO sizes, which is changed here |
| 2026-10-20 | Japanese interface catalog covers every key the Brazilian Portuguese catalog translates: the 398-label shared core plus 545 dialog, message, Backstage and menu strings (943 total, ~43% of ~2,200). A test parses `pt.rs`'s source, so the two catalogs stay in step |
+45 -13
View File
@@ -23,7 +23,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Export as PDF",
["File", "Export"],
None,
"{path?, sheets?: active|all, range?: \"A1:F40\" (active sheet), fitToPage?: bool} → {pages, bytes, path} or {pages, bytes, base64} when no path. Honours each sheet's Page Setup.",
"{path?, sheets?: active|all, range?: \"A1:F40\" or several areas \"A1:B5,D1:E5\", one run of pages each (active sheet), fitToPage?: bool} → {pages, bytes, path} or {pages, bytes, base64} when no path. Honours each sheet's Page Setup.",
has_doc,
export_pdf
),
@@ -145,7 +145,8 @@ impl SheetLayout {
#[derive(Clone, Debug, Default)]
pub struct PrintOptions {
pub all_sheets: bool,
pub range: Option<RangeRef>,
/// Areas of the active sheet to print instead of its print area, in order (Print Selection).
pub ranges: Vec<RangeRef>,
pub fit_to_page: Option<bool>,
}
@@ -156,11 +157,13 @@ impl PrintOptions {
Some("all") | Some("workbook") => true,
Some(other) => return Err(bad(cmd, format!("`sheets` must be active or all, not `{other}`"))),
};
let range = match str_param(p, "range").map(str::trim).filter(|r| !r.is_empty()) {
Some(r) => Some(RangeRef::parse(split_sheet(r).1).ok_or_else(|| bad(cmd, format!("not a range: `{r}`")))?),
None => None,
};
Ok(PrintOptions { all_sheets, range, fit_to_page: bool_param(p, "fitToPage") })
let mut ranges = Vec::new();
if let Some(r) = str_param(p, "range").map(str::trim).filter(|r| !r.is_empty()) {
for part in split_sheet(r).1.split(',') {
ranges.push(RangeRef::parse(part.trim()).ok_or_else(|| bad(cmd, format!("not a range: `{r}`")))?);
}
}
Ok(PrintOptions { all_sheets, ranges, fit_to_page: bool_param(p, "fitToPage") })
}
}
@@ -376,14 +379,20 @@ pub fn layouts(wb: &Workbook, opts: &PrintOptions) -> Vec<SheetLayout> {
if pages >= MAX_PAGES {
break;
}
let ovr = if si == wb.active_sheet { opts.range } else { None };
if opts.all_sheets && ovr.is_none() && wb.sheet(si).is_some_and(|s| print_range(s).is_none()) {
let areas: Vec<Option<RangeRef>> =
if si == wb.active_sheet && !opts.ranges.is_empty() { opts.ranges.iter().copied().map(Some).collect() } else { vec![None] };
if opts.all_sheets && areas == [None] && wb.sheet(si).is_some_and(|s| print_range(s).is_none()) {
continue;
}
if let Some(mut l) = layout_sheet(wb, si, opts, ovr) {
l.pages.truncate(MAX_PAGES - pages);
pages += l.pages.len();
out.push(l);
for ovr in areas {
if pages >= MAX_PAGES {
break;
}
if let Some(mut l) = layout_sheet(wb, si, opts, ovr) {
l.pages.truncate(MAX_PAGES - pages);
pages += l.pages.len();
out.push(l);
}
}
}
if out.is_empty() && opts.all_sheets {
@@ -1859,6 +1868,29 @@ mod tests {
assert!(!cropped.contains("/Dest ["));
}
fn preview_ranges(s: &mut Session, p: Json) -> Vec<String> {
let r = s.execute("file.printPreview", p).unwrap();
r["pageList"].as_array().unwrap().iter().map(|pg| pg["range"].as_str().unwrap().to_string()).collect()
}
#[test]
fn a_range_prints_instead_of_the_print_area_and_each_area_gets_its_own_pages() {
let mut s = s();
s.execute("cell.set", json!({"cell": "A1", "input": "x"})).unwrap();
s.execute("cell.set", json!({"cell": "H20", "input": "y"})).unwrap();
s.execute("pageLayout.pageSetup", json!({"printArea": "F10:H20"})).unwrap();
assert_eq!(preview_ranges(&mut s, json!({})), ["F10:H20"]);
assert_eq!(preview_ranges(&mut s, json!({"range": "A1:B2"})), ["A1:B2"]);
// Several areas, like a multi-area selection: one run of pages each, in the order given.
assert_eq!(preview_ranges(&mut s, json!({"range": "D4:E5,A1:B2"})), ["D4:E5", "A1:B2"]);
assert_eq!(preview_ranges(&mut s, json!({"range": "Sheet1!A1:B2, D4:E5"})), ["A1:B2", "D4:E5"]);
let (_, pages) = pdf_of(&mut s, json!({"range": "A1:B2,D4:E5"}));
assert_eq!(pages, 2);
for bad in ["A1:B2,", "A1:B2,nope", ","] {
assert!(s.execute("file.printPreview", json!({"range": bad})).is_err(), "{bad}");
}
}
#[test]
fn header_sections_split_join_and_field_names() {
let spec = "&L&\"Arial,Bold\"Sales &&Co&CPage &P of &N&R&D";
+40 -12
View File
@@ -102,20 +102,41 @@ const PROPERTIES: [(&str, &str); 6] = [
("description", "Description"),
];
/// What File › Print › Settings prints.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PrintScope {
ActiveSheets,
EntireWorkbook,
/// The selected cells of the active sheet.
Selection,
}
impl PrintScope {
const ALL: [PrintScope; 3] = [PrintScope::ActiveSheets, PrintScope::EntireWorkbook, PrintScope::Selection];
fn label(self) -> &'static str {
match self {
PrintScope::ActiveSheets => "Print Active Sheets",
PrintScope::EntireWorkbook => "Print Entire Workbook",
PrintScope::Selection => "Print Selection",
}
}
}
/// The open Backstage view.
#[derive(Clone, Debug)]
pub struct Backstage {
pub page: Page,
/// Info: property drafts while a field is being edited (committed when it loses focus).
props: [String; 6],
/// Print: the whole workbook rather than the active sheet.
pub print_all: bool,
/// Print: what to print (the Settings menu's first choice).
pub print_scope: PrintScope,
/// Print: fit each sheet on one page.
pub fit_to_page: bool,
/// Print: the previewed page (0-based).
preview_page: usize,
/// Print: the preview for (document, revision, whole workbook, fit to page).
preview: Option<((u64, u64, bool, bool), Json)>,
/// Print: the preview for (document, revision, scope, the selection when it is the scope, fit to page).
preview: Option<((u64, u64, PrintScope, String, bool), Json)>,
/// Save As: the chosen file type (an extension from [`SAVE_TYPES`]).
pub save_format: &'static str,
/// Home and Open: when the recent workbooks were last changed.
@@ -132,7 +153,7 @@ impl Backstage {
Backstage {
page,
props: Default::default(),
print_all: false,
print_scope: PrintScope::ActiveSheets,
fit_to_page: false,
preview_page: 0,
preview: None,
@@ -703,11 +724,19 @@ fn print(app: &mut SheetApp, ui: &mut Ui, bs: &mut Backstage, out: &mut Outcome)
dim(ui, lang.tr("No workbook is open."));
return;
};
let mut params = json!({"sheets": if bs.print_all { "all" } else { "active" }});
let mut params = json!({"sheets": if bs.print_scope == PrintScope::EntireWorkbook { "all" } else { "active" }});
// The selection is not part of the document revision, so it goes in the preview's key.
let mut selection = String::new();
if bs.print_scope == PrintScope::Selection
&& let Some(d) = app.session.active()
{
selection = d.selection.a1();
params["range"] = json!(selection);
}
if bs.fit_to_page {
params["fitToPage"] = json!(true);
}
let key = (uid, revision, bs.print_all, bs.fit_to_page);
let key = (uid, revision, bs.print_scope, selection, bs.fit_to_page);
if bs.preview.as_ref().is_none_or(|(k, _)| *k != key) {
let preview = app.session.run("file.printPreview", params.clone()).unwrap_or(Json::Null);
bs.preview = Some((key, preview));
@@ -727,11 +756,10 @@ fn print(app: &mut SheetApp, ui: &mut Ui, bs: &mut Backstage, out: &mut Outcome)
out.close = app.services.print_native.is_none();
}
ui.add_space(16.0);
let scope = if bs.print_all { "Print Entire Workbook" } else { "Print Active Sheets" };
egui::ComboBox::from_id_salt("backstage_print_scope").width(230.0).selected_text(lang.tr(scope)).show_ui(ui, |ui| {
for (all, label) in [(false, "Print Active Sheets"), (true, "Print Entire Workbook")] {
if ui.selectable_label(bs.print_all == all, lang.tr(label)).clicked() {
bs.print_all = all;
egui::ComboBox::from_id_salt("backstage_print_scope").width(230.0).selected_text(lang.tr(bs.print_scope.label())).show_ui(ui, |ui| {
for scope in PrintScope::ALL {
if ui.selectable_label(bs.print_scope == scope, lang.tr(scope.label())).clicked() {
bs.print_scope = scope;
bs.preview_page = 0;
}
}
+1
View File
@@ -308,6 +308,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Uloží sešit pod jiným názvem nebo do jiné složky.",
"Print Active Sheets" => "Vytisknout aktivní listy",
"Print Entire Workbook" => "Vytisknout celý sešit",
"Print Selection" => "Vytisknout výběr",
"Fit Sheet on One Page" => "Přizpůsobit list na jednu stránku",
"Page Setup…" => "Vzhled stránky…",
"Page {page} of {pages}" => "Stránka {page} z {pages}",
+1
View File
@@ -313,6 +313,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
}
"Print Active Sheets" => "Aktive Blätter drucken",
"Print Entire Workbook" => "Gesamte Arbeitsmappe drucken",
"Print Selection" => "Auswahl drucken",
"Fit Sheet on One Page" => "Blatt auf einer Seite darstellen",
"Page Setup…" => "Seite einrichten…",
"Page {page} of {pages}" => "Seite {page} von {pages}",
+1
View File
@@ -284,6 +284,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Αποθηκεύστε το βιβλίο εργασίας με άλλο όνομα ή σε άλλον φάκελο.",
"Print Active Sheets" => "Εκτύπωση ενεργών φύλλων",
"Print Entire Workbook" => "Εκτύπωση ολόκληρου βιβλίου εργασίας",
"Print Selection" => "Εκτύπωση επιλογής",
"Fit Sheet on One Page" => "Προσαρμογή φύλλου σε μία σελίδα",
"Page Setup…" => "Διαμόρφωση σελίδας…",
"Page {page} of {pages}" => "Σελίδα {page} από {pages}",
+1
View File
@@ -310,6 +310,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Guarda el libro con otro nombre o en otra carpeta.",
"Print Active Sheets" => "Imprimir hojas activas",
"Print Entire Workbook" => "Imprimir todo el libro",
"Print Selection" => "Imprimir selección",
"Fit Sheet on One Page" => "Ajustar hoja en una página",
"Page Setup…" => "Configurar página…",
"Page {page} of {pages}" => "Página {page} de {pages}",
+1
View File
@@ -395,6 +395,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Enregistrer le classeur sous un autre nom ou dans un autre dossier.",
"Print Active Sheets" => "Imprimer les feuilles actives",
"Print Entire Workbook" => "Imprimer tout le classeur",
"Print Selection" => "Imprimer la sélection",
"Fit Sheet on One Page" => "Ajuster la feuille sur une page",
"Page Setup…" => "Mise en page…",
"Page {page} of {pages}" => "Page {page} sur {pages}",
+1
View File
@@ -384,6 +384,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Salva la cartella di lavoro con un altro nome o in un'altra cartella.",
"Print Active Sheets" => "Stampa fogli attivi",
"Print Entire Workbook" => "Stampa intera cartella di lavoro",
"Print Selection" => "Stampa selezione",
"Fit Sheet on One Page" => "Adatta foglio a una pagina",
"Page Setup…" => "Imposta pagina…",
"Page {page} of {pages}" => "Pagina {page} di {pages}",
+4 -3
View File
@@ -391,6 +391,7 @@ pub(super) const CORE: &[(&str, &str)] = &[
("Save the workbook under another name or in another folder.", "ブックを別の名前または別のフォルダーに保存します。"),
("Print Active Sheets", "作業中のシートを印刷"),
("Print Entire Workbook", "ブック全体を印刷"),
("Print Selection", "選択した部分を印刷"),
("Fit Sheet on One Page", "シートを 1 ページに印刷"),
("Page Setup…", "ページ設定…"),
("Page {page} of {pages}", "{page} / {pages} ページ"),
@@ -1236,9 +1237,9 @@ mod tests {
assert!(seen.insert(*english), "duplicate key across CORE and DIALOGS: {english:?}");
}
assert_eq!(seen.len(), catalog_keys().count());
assert_eq!(CORE.len(), 392, "the shared reference set every catalog covers");
assert_eq!(CORE.len(), 393, "the shared reference set every catalog covers");
assert_eq!(DIALOGS.len(), 562, "the dialog, message and menu strings beyond it");
assert_eq!(catalog_keys().count(), 954);
assert_eq!(catalog_keys().count(), 955);
}
#[test]
@@ -1256,7 +1257,7 @@ mod tests {
#[test]
fn covers_every_key_the_portuguese_catalog_translates() {
let portuguese = portuguese_keys();
assert_eq!(portuguese.len(), 954, "pt.rs's arms changed: add the new keys here and update the count");
assert_eq!(portuguese.len(), 955, "pt.rs's arms changed: add the new keys here and update the count");
let japanese: HashSet<&str> = catalog_keys().collect();
for key in &portuguese {
assert!(japanese.contains(key.as_str()), "the Portuguese catalog translates {key:?}, the Japanese one does not");
+1
View File
@@ -397,6 +397,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "통합 문서를 다른 이름 또는 다른 폴더에 저장합니다.",
"Print Active Sheets" => "활성 시트 인쇄",
"Print Entire Workbook" => "전체 통합 문서 인쇄",
"Print Selection" => "선택 영역 인쇄",
"Fit Sheet on One Page" => "한 페이지에 시트 맞추기",
"Page Setup…" => "페이지 설정…",
"Page {page} of {pages}" => "{page}/{pages} 페이지",
+1
View File
@@ -383,6 +383,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "De werkmap onder een andere naam of in een andere map opslaan.",
"Print Active Sheets" => "Actieve bladen afdrukken",
"Print Entire Workbook" => "Hele werkmap afdrukken",
"Print Selection" => "Selectie afdrukken",
"Fit Sheet on One Page" => "Blad op één pagina passen",
"Page Setup…" => "Pagina-instelling…",
"Page {page} of {pages}" => "Pagina {page} van {pages}",
+1
View File
@@ -378,6 +378,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Zapisz skoroszyt pod inną nazwą lub w innym folderze.",
"Print Active Sheets" => "Drukuj aktywne arkusze",
"Print Entire Workbook" => "Drukuj cały skoroszyt",
"Print Selection" => "Drukuj zaznaczenie",
"Fit Sheet on One Page" => "Dopasuj arkusz do jednej strony",
"Page Setup…" => "Ustawienia strony…",
"Page {page} of {pages}" => "Strona {page} z {pages}",
+1
View File
@@ -390,6 +390,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Salve a pasta de trabalho com outro nome ou em outra pasta.",
"Print Active Sheets" => "Imprimir planilhas ativas",
"Print Entire Workbook" => "Imprimir toda a pasta de trabalho",
"Print Selection" => "Imprimir seleção",
"Fit Sheet on One Page" => "Ajustar planilha em uma página",
"Page Setup…" => "Configurar página…",
"Page {page} of {pages}" => "Página {page} de {pages}",
+1
View File
@@ -385,6 +385,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Salvează registrul cu alt nume sau în alt folder.",
"Print Active Sheets" => "Imprimare foi active",
"Print Entire Workbook" => "Imprimare tot registrul",
"Print Selection" => "Imprimare selecție",
"Fit Sheet on One Page" => "Încadrare foaie pe o pagină",
"Page Setup…" => "Configurare pagină…",
"Page {page} of {pages}" => "Pagina {page} din {pages}",
+1
View File
@@ -397,6 +397,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Сохранить книгу под другим именем или в другой папке.",
"Print Active Sheets" => "Напечатать активные листы",
"Print Entire Workbook" => "Напечатать всю книгу",
"Print Selection" => "Напечатать выделенный диапазон",
"Fit Sheet on One Page" => "Вписать лист на одну страницу",
"Page Setup…" => "Параметры страницы…",
"Page {page} of {pages}" => "Страница {page} из {pages}",
+1
View File
@@ -389,6 +389,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Sačuvaj radnu svesku pod drugim imenom ili u drugoj fascikli.",
"Print Active Sheets" => "Štampaj aktivne listove",
"Print Entire Workbook" => "Štampaj celu radnu svesku",
"Print Selection" => "Štampaj izbor",
"Fit Sheet on One Page" => "Uklopi list na jednu stranicu",
"Page Setup…" => "Podešavanje stranice…",
"Page {page} of {pages}" => "Stranica {page} od {pages}",
+1
View File
@@ -299,6 +299,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Çalışma kitabını başka bir adla veya başka bir klasöre kaydedin.",
"Print Active Sheets" => "Etkin Sayfaları Yazdır",
"Print Entire Workbook" => "Tüm Çalışma Kitabını Yazdır",
"Print Selection" => "Seçimi Yazdır",
"Fit Sheet on One Page" => "Sayfayı Bir Sayfaya Sığdır",
"Page Setup…" => "Sayfa Yapısı…",
"Page {page} of {pages}" => "Sayfa {page} / {pages}",
+1
View File
@@ -383,6 +383,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Зберегти книгу під іншим іменем або в іншій теці.",
"Print Active Sheets" => "Надрукувати активні аркуші",
"Print Entire Workbook" => "Надрукувати всю книгу",
"Print Selection" => "Надрукувати виділений діапазон",
"Fit Sheet on One Page" => "Вмістити аркуш на одну сторінку",
"Page Setup…" => "Параметри сторінки…",
"Page {page} of {pages}" => "Сторінка {page} з {pages}",
+1
View File
@@ -388,6 +388,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "Lưu sổ làm việc với tên khác hoặc vào thư mục khác.",
"Print Active Sheets" => "In các trang tính hiện hoạt",
"Print Entire Workbook" => "In toàn bộ sổ làm việc",
"Print Selection" => "In vùng chọn",
"Fit Sheet on One Page" => "Vừa trang tính trên một trang",
"Page Setup…" => "Thiết lập trang…",
"Page {page} of {pages}" => "Trang {page} / {pages}",
+1
View File
@@ -389,6 +389,7 @@ pub(super) fn translate(text: &str) -> Option<&'static str> {
"Save the workbook under another name or in another folder." => "以其他名称或在其他文件夹中保存工作簿。",
"Print Active Sheets" => "打印活动工作表",
"Print Entire Workbook" => "打印整个工作簿",
"Print Selection" => "打印选定区域",
"Fit Sheet on One Page" => "将工作表调整为一页",
"Page Setup…" => "页面设置…",
"Page {page} of {pages}" => "第 {page} 页,共 {pages} 页",
+78
View File
@@ -0,0 +1,78 @@
//! File › Print › Settings offers "Print Selection": only the selected cells are previewed and sent.
use std::{cell::RefCell, rc::Rc};
use egui_kittest::kittest::Queryable as _;
use gridcraft_engine::Session;
use gridcraft_ui_egui::{Services, SheetApp};
use serde_json::json;
fn contains(hay: &[u8], needle: &str) -> bool {
hay.windows(needle.len()).any(|w| w == needle.as_bytes())
}
/// A sheet whose print area (F10:H20, "Outside") is not where the selection (A1:B2, "Inside") is,
/// so printing the selection and printing the sheet give different pages.
fn harness(jobs: Rc<RefCell<Vec<Vec<u8>>>>) -> egui_kittest::Harness<'static, SheetApp> {
let mut session = Session::new();
session.new_workbook();
let mut app = SheetApp::new(session, Services::default());
app.run("cell.set", json!({"cell": "A1", "input": "Inside"})).unwrap();
app.run("cell.set", json!({"cell": "D4", "input": "Second area"})).unwrap();
app.run("cell.set", json!({"cell": "H20", "input": "Outside"})).unwrap();
app.run("pageLayout.pageSetup", json!({"printArea": "F10:H20"})).unwrap();
app.run("selection.set", json!({"range": "A1:B2"})).unwrap();
app.services.print = Some(Box::new(move |bytes| jobs.borrow_mut().push(bytes.to_vec())));
app.run("ui.backstage", json!({"page": "print"})).unwrap();
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1000.0, 800.0)).build_ui_state(
|ui, app: &mut SheetApp| {
app.logic(ui.ctx());
app.ui(ui);
},
app,
);
h.run_steps(4);
h
}
fn choose_selection(h: &mut egui_kittest::Harness<'static, SheetApp>) {
h.get_all_by_role(egui::accesskit::Role::ComboBox).next().expect("print scope combo").click();
h.run_steps(3);
h.get_by_label("Print Selection").click();
h.run_steps(4);
}
#[test]
fn print_selection_previews_and_prints_only_the_selected_cells() {
let jobs = Rc::new(RefCell::new(Vec::new()));
let mut h = harness(jobs.clone());
assert!(h.query_by_label("Sheet1 · F10:H20").is_some(), "the sheet prints its print area by default");
choose_selection(&mut h);
assert!(h.query_by_label("Sheet1 · A1:B2").is_some(), "the preview shows the selection");
assert!(h.query_by_label("Sheet1 · F10:H20").is_none());
h.get_all_by_role_and_label(egui::accesskit::Role::Button, "Print").last().expect("Print button").click();
h.run_steps(3);
let jobs = jobs.borrow();
assert_eq!(jobs.len(), 1);
assert!(contains(&jobs[0], "(Inside) Tj"), "the selected cell is printed");
assert!(!contains(&jobs[0], "(Outside) Tj"), "the print area is not");
}
#[test]
fn the_preview_follows_the_selection_and_each_area_gets_its_own_page() {
let jobs = Rc::new(RefCell::new(Vec::new()));
let mut h = harness(jobs.clone());
choose_selection(&mut h);
assert!(h.query_by_label("Sheet1 · A1:B2").is_some());
// Same document revision, other selection: the cached preview must not be reused.
h.state_mut().run("selection.set", json!({"range": "D4:E5"})).unwrap();
h.run_steps(4);
assert!(h.query_by_label("Sheet1 · D4:E5").is_some(), "the preview is rebuilt for the new selection");
assert!(h.query_by_label("Sheet1 · A1:B2").is_none());
// Two selected areas: Excel prints each area on its own page.
h.state_mut().run("selection.set", json!({"range": "A1:B2,D4:E5"})).unwrap();
h.run_steps(4);
assert!(h.query_by_label("Page 1 of 2").is_some(), "two areas, two pages");
}
+3 -2
View File
@@ -1,6 +1,6 @@
# Gaps
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-20 · **Change:** minor (the Japanese catalog covers the dialogs, messages and menus) · **Target:** Microsoft Excel (Microsoft 365)
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-23 · **Change:** minor (File › Print › Settings: Print Selection; previously: the Japanese catalog covers the dialogs, messages and menus) · **Target:** Microsoft Excel (Microsoft 365)
Every known shortfall against Excel, one entry each, ranked by user impact (what blocks someone
using GridCraft for real work first). This is the work list: pick from the top, check the open
@@ -127,7 +127,7 @@ No alpha blockers: every core workflow passes the [alpha gate](roadmap.md#alpha-
### 14. Page Layout view and print polish (U, F)
- Page Layout view landed (#329): paper view with rulers and in-place header/footer editing.
Margins are dragged on the rulers (#792). Remaining: pictures in headers/footers, Different First Page / Odd & Even pages. Desktop now submits directly through craft-print with printer choice, copies, duplex and grayscale; browser printing stays available. Print ranges and driver tray/options UI remain. **Estimate:** 5–10 h.
Margins are dragged on the rulers (#792). Remaining: pictures in headers/footers, Different First Page / Odd & Even pages. Desktop now submits directly through craft-print with printer choice, copies, duplex and grayscale; browser printing stays available. Print Selection landed (File › Print › Settings); Set Print Area is in Page Layout. Driver tray/options UI remains. **Estimate:** 5–10 h.
### 15. Remaining functions and an oracle suite (F)
- 18 missing, 9 stubs; no Excel-computed oracle corpus; #137, #138. **Estimate:** 16–26 h.
@@ -178,6 +178,7 @@ No alpha blockers: every core workflow passes the [alpha gate](roadmap.md#alpha-
| Date | Change | Summary |
|---|---|---|
| 2026-10-23 | minor | §14: Print Selection landed in File › Print › Settings (several selected areas print one after the other); "print ranges" removed from the remainder |
| 2026-10-20 | minor | §11: the Japanese catalog covers the dialogs, messages and menus — 943 keys (~43%), matching the pt-BR coverage; a test keeps the two catalogs in step |
| 2026-10-17 | minor | §6: the five reports it tracked are closed and their PRs merged (#57, #133, #139, #140, #134; PRs #148, #155, #156, #157); the entry stays open for §15's oracle suite |
| 2026-10-15 | minor | §13: Solver prepares reports before committing the solution, model and report sheets together; report refusal preserves the workbook and Undo/Redo (#1050) |
+3 -2
View File
@@ -1,6 +1,6 @@
# UI parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (Page Up and Ctrl+Up into frozen rows, Ctrl+Left and Alt+Page Up into frozen columns bring the scrolled area back; Auto Fill Options button after a left-drag of the fill handle (#1403); Show Outline Symbols, Ctrl+8; a too-wide number in a repeat-fill format such as Accounting shows #### instead of losing its leading digits; Esc and Enter close a data validation alert over the cell editor; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Number Stored as Text indicator and Convert to Number) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-23 · **Change:** minor (File › Print › Settings: Print Selection; Page Up and Ctrl+Up into frozen rows, Ctrl+Left and Alt+Page Up into frozen columns bring the scrolled area back; Auto Fill Options button after a left-drag of the fill handle (#1403); Show Outline Symbols, Ctrl+8; a too-wide number in a repeat-fill format such as Accounting shows #### instead of losing its leading digits; Esc and Enter close a data validation alert over the cell editor; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Number Stored as Text indicator and Convert to Number) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md).
**UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured
@@ -30,7 +30,7 @@ Sources: `crates/ui-egui/src` (ribbon, grid, editor, formula bar, dialogs, panes
| Task panes (Format Chart, Comments, Watch, Selection, PivotTable fields) | yes | yes; PivotTable source-field list scrollbar sits at the right edge of its pane | element-level Format pane for shapes and pictures missing |
| Backstage (File) view: Info, New with templates, Open recent, Export, Options | yes | partial | Options dialog and template gallery missing |
| Dark mode, system appearance | yes | yes | done (10-09); follows the system on first run, title-bar switch and File › Display theme (#194, #239) |
| Backstage (File) view: Info, New with templates, Open recent, Export, Options | yes | yes (#174, 10-11): the File tab opens a full-window view (Esc or the back arrow return) with Home, New (blank + the three samples), Open (recent + Browse; the recent list tells when each workbook was last changed, 10-12), Info (location, properties, Protect Workbook), Save, Save As, Print (page preview, active sheet or workbook, fit to page, Page Setup), Export (PDF, CSV, web page), Close and Options (`file.options`: theme, language, formula bar, AutoSave, calculation) | no Account, Share or template gallery beyond the samples; Options applies at once (no OK/Cancel dialog) and holds only the settings GridCraft has |
| Backstage (File) view: Info, New with templates, Open recent, Export, Options | yes | yes (#174, 10-11): the File tab opens a full-window view (Esc or the back arrow return) with Home, New (blank + the three samples), Open (recent + Browse; the recent list tells when each workbook was last changed, 10-12), Info (location, properties, Protect Workbook), Save, Save As, Print (page preview, active sheet, workbook or selection, fit to page, Page Setup), Export (PDF, CSV, web page), Close and Options (`file.options`: theme, language, formula bar, AutoSave, calculation) | no Account, Share or template gallery beyond the samples; Options applies at once (no OK/Cancel dialog) and holds only the settings GridCraft has |
| Dark mode, system appearance | yes | yes | done (10-09) |
| Page Layout view (paper view with rulers and header editing) | yes | yes (#329, 10-11): per-sheet view saved in XLSX, pages with margins and gaps on the print pagination, "Click to add data" pages, rulers (inches or centimetres), headers and footers drawn and edited in place with a Header & Footer tab | margins drag on the rulers (#792, with header and footer margins); header/footer pictures, Different First Page / Odd & Even missing (1–3 h) |
| Multiple windows per workbook | yes | no (#162) | see [hardware-parity.md](hardware-parity.md) |
@@ -175,6 +175,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
| Date | Change | Summary |
|---|---|---|
| 2026-10-23 | minor | File › Print › Settings offers Print Selection next to Print Active Sheets and Print Entire Workbook: the preview and the printed PDF cover the selected cells, and a selection of several areas prints each area on its own pages, as in Excel (`file.print`, `file.exportPdf` and `file.printPreview` accept `range: "A1:B5,D1:E5"`). A single selected cell prints that cell |
| 2026-10-23 | minor | Frozen panes: Page Up, Ctrl+Up and Shift variants that move from the scrolled rows into the frozen ones bring the scrolled rows back to the top, so the rows in between are seen again (Page Up from far down used to end on row 1 with the view still a page down); Ctrl+Left and Alt+Page Up do the same for frozen columns. Other ways of selecting a frozen cell (click, Find, Go To, Undo, formula pointing) leave the view where it is |
| 2026-10-23 | minor | After a left-drag of the fill handle an Auto Fill Options button sits below the filled cells; its menu redoes the fill as Copy Cells, Fill Series, Fill Formatting Only or Fill Without Formatting (undoes the drag's fill, then `edit.autoFill` in that mode). It goes away when the workbook changes or the selection moves (#1403) |
| 2026-10-22 | minor | Show Outline Symbols (`view.showOutlineSymbols`, Ctrl+8): a sheet can hide the outline's level buttons and brackets while keeping its outline, as Excel saves with `showOutlineSymbols="0"` (read and written); the grid then gives the bands no room |