feat: Read Word, PowerPoint and Excel files natively

Merged
DE
4d ago
+9379-34

Opens office files without LibreOffice, Keynote, Pages or Numbers. leaf reads the zip/XML itself, so it works the same on macOS and Linux and opens in milliseconds.

What opens

  • Decks (.pptx, .pptm, .ppsx, .potx…): each slide drawn from its master, layout and theme, with shapes, pictures, fonts, tables, charts and SmartArt. Speaker notes sit beneath.
  • Word (.docx, .docm, .dotx…): styles, lists, tables, pictures and fields laid out on the document's page size and margins.
  • Spreadsheets (.xlsx, .xlsm, .xlsb, .xls, .ods, .csv, .tsv): a real grid with column letters and row numbers. .xlsx brings cell fonts, fills, borders, alignment, column widths and row heights.

Looks

  • Opens as designed (a picture in the file's own fonts and colors).
  • o switches to the terminal's font: markdown text and tables. The page stays the same.
  • i switches the designed page between real colors and terminal-painted.
  • The footer shows both keys.

Older and Apple formats (.doc, .ppt, .key, .pages, .numbers) get a message saying what to save them as.

Tests

cargo test: 591 pass. New tests cover Word headings, emphasis, fields, list numbering, tables, pagination shared by both looks, and rendering, plus Excel style and sheet parsing and grid drawing. Also checked by eye on a real .docx and on styled .xlsx and .csv files.

šŸ¤– Generated with Claude Code


Summary by cubic

Leaf now opens Word, PowerPoint, and Excel files natively — it reads the zip/XML directly, so no LibreOffice, Keynote, Pages, or Numbers is needed and files open in milliseconds on macOS and Linux. Older and Apple formats (.doc, .ppt, .key, .pages, .numbers) show a message suggesting what to save them as.

Rendering

  • Decks draw each slide from its master, layout, and theme: shapes, pictures, tables, charts, and SmartArt, with speaker notes beneath; in the terminal look, side-by-side cards read one at a time and the largest short line becomes the title.
  • Word documents lay out styles, lists, tables, pictures, and fields on the document's own page size and margins; list numbering restarts where Word says and otherwise continues across shared definitions, as Word does.
  • Spreadsheets draw a real grid with column letters and row numbers; .xlsx/.xlsm workbooks keep cell fonts, fills, borders, alignment, widths, and heights while other formats get a plain grid, and a narrow sheet takes its share of the column.

Views

  • Files open as designed, in their own fonts and colors; pages fill the reading column, and +/- zooms.
  • o switches to the terminal's font (markdown and tables) keeping the same page, and i switches the designed page between real colors and terminal-painted colors.
  • a in the designed look switches to the text and reads it aloud; o stops reading.
  • Damaged or hostile files are capped and bounded instead of crashing.