Repository navigation
Open SYLK (.slk) files: values, R1C1 formulas, number formats, widths (#1481) - #3253
Merged
Merged
Conversation
A small reader for the SYLK text format: cell values (numbers, text, booleans, errors), formulas converted from R1C1 to A1 as Excel does (relative/absolute references, ranges, whole rows and columns, shared formulas) with their cached results, number formats (P / F;P) and column widths (F;W). Import only; saving as .slk says so. The sheet is named after the file, and damaged records are skipped with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Nov 3, 2026
- #3223: sniff the first 64 KiB for a web page and skip JSON and files over the text-import cap, so every CSV/TSV is no longer decoded in full before the size check. - #3253: SYLK relative offsets use checked arithmetic (no overflow on R[9223372036854775807]); at most 1024 column-width records are kept; regression test. - #3254: a single selected merged cell searches the whole sheet, as one selected cell does. - #3252: the formula bar's height cap is half the room below the ribbon, not half the window, so the worksheet stays visible in a short window (CodeRabbit Major). - #3239, #3244, #3252, #3268: es/de/cs/zh/ko/ru/pt entries for the new interface strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Merged — thank you @hectorviov for the contribution! I added one review fix on main (865a789): relative R1C1 offsets use checked arithmetic (no overflow on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1481
What changed
GridCraft now opens SYLK (
.slk) files. The new reader iscrates/engine/src/io/sylk.rs, andFileKind::Sylksends.slkfiles to it. It reads:"text",TRUE/FALSEand errors.;;inside a field is a literal semicolon. Text is kept between its outer quotes exactly as written, which is how Excel reads it.C4becomes$D:$D) and whole rows (R3becomes$3:$3). Shared formulas (S;R…;C…) are the other cell's formula moved to this cell. Function and name words such asROUND,RATEorR2D2are left alone, and so are quoted text and quoted sheet names. A reference that falls off the sheet becomes#REF!. Each formula keeps the value cached in the file.P;P…builds the list of formats andF;P<n>applies one. Like Excel, anFrecord with onlyXformats the cell on the current row.F;W<first> <last> <width>, in characters.Saving as
.slkreports that SYLK is import only, the same as ODS and XLSB..slkis also added to the Open dialog's Spreadsheets filter on desktop and web. A file that doesn't start withIDis refused. Damaged records (positions off the sheet, formulas that don't parse) are skipped with one warning.Three-way comparison
I wrote one SYLK file by hand from the public format description. It has values, formulas, a shared formula, number formats and widths, and I opened it in each app:
ID(the file is read as CSV text, one record per row)=B2*C2→ 4.2=B2*C2→ 4.2=$B$2+B3→ 52=$B$2+B3→ 52=IF($D$4>5,"big","small")→ big=D3*2→ 9.6=D3*2→ 9.6=SUM($D:$D)→ 18=SUM($D:$D)→ 18The Excel column was read by AppleScript from Excel for Mac after it opened the same file. Excel's sandbox wouldn't let it save a SYLK file somewhere I could read, so the test input is my own text and not an Excel export.
Tests
io::tests::sylk_files_open_with_values_formulas_formats_and_widthscovers the file above. It fails on main, where A1 reads "ID".io::tests::sylk_r1c1_formulas_become_a1has 13 conversion cases, including names that look like references, quoted text and sheets, and references off the sheet.io::tests::sylk_rejects_other_files_and_survives_damagechecks a file withoutID, positions off the grid, a number that overflows, an unknown format index, a reversed width range and an unparseable formula.cargo xtask cipasses.Anything a reviewer should look at first
crates/xlsx, because the formula text goes throughFormula::newlike the other importers. The R1C1 conversion is its own small scanner, so thexlsxcrate is untouched.P;Ffont records, and theF;Sflags I tried (bold, italic) changed nothing in Excel either. Row heights, names and comments aren't read yet. The file-format parity row lists these.ESCsequences for accented characters aren't decoded.🤖 Generated with Claude Code