Skip to content

Fix #407, #410: repeat Excel print title rows in PDF, read HP-GL plot files (.plt) - #432

Merged
KnifeLemon merged 3 commits into
KnifeLemon:mainfrom
cre8ive-marketing:fix/issues-batch-4
Oct 23, 2026
Merged

KnifeLemon merged 3 commits into
KnifeLemon:mainfrom
cre8ive-marketing:fix/issues-batch-4

Conversation

@cre8ive-marketing

@cre8ive-marketing cre8ive-marketing commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What does this change?

Fixes a bug from #407 and adds a format from #410. There is one commit for each, with tests and a line in docs/ENGINES.md.

Issue Type What changes
#407 "엑셀-PDF 행 반복이 적용이 안됩니다" (Excel → PDF: repeated rows are missing) bug Before: XLSX → PDF (built-in route: XLSX → HWPX → rhwp) repeated only frozen top rows on each page. A sheet's Rows to repeat at top (Page Layout → Print Titles) were ignored, so a bill of quantities lost its column headings after page 1.
Now: XlsxReader reads the _xlnm.Print_Titles defined name of each sheet, matched by localSheetId (hidden sheets count in that index). Worksheet.TitleRows stores the rows. SheetDocument starts every page's table with those rows as HWPX header rows. Rows above the print titles (a document title) appear once, in a table before them. Without print titles, frozen rows repeat exactly as before.
#410 "Format request: .plt" enhancement HP-GL and HP-GL/2 plot files (.plt, also .hpgl, .hpg, .hgl) are a new read-only vector format. Vector/HpglPlot.cs draws the pen moves as SVG polylines at the plot's real size (40 units per mm), with pen colours (SP, PC) and widths (PW). The vector engine renders PDF, PNG, JPG, … from that SVG.
Read: IN, PU/PD/PA/PR, CI, AA/AR, polygons (PM/EP/FP), and the packed PE polylines that Windows printer drivers (AutoCAD "plot to file") write inside a PJL/PCL wrapper.
Not drawn: text labels (LB), fill patterns and raster data. SC scaling is ignored.
A .plt without HP-GL (PostScript or PCL raster output) fails with that reason.

Settings schema 33 teaches the vector donut .plt, .hpgl, .hpg and .hgl, unless the user's own donut already claims them. Like #351, #393, #401 and #429, this uses schema 33, so it needs renumbering after #351. Happy to do that, or leave it to you.

Overlap with #401: both PRs change TracingTests.IsTracing in the same line. #401 adds "dst", this one adds "plt": step.From is not ("svgz" or "plt"). Whichever merges second should keep both: ("svgz" or "dst" or "plt").

The PE sample in the tests was encoded independently of Filee's decoder, so the decoder isn't only checked against itself.

How was it tested?

  • dotnet format --verify-no-changes
  • dotnet test with FFmpeg 9.0.2, rhwp 0.8.7 and Tesseract 5.4: Platform 48, Core 457, Cli 27, Setup 145, Engines 1467, App 807 pass, none fail.
  • New tests:
    • OfficeTests (엑셀-PDF 행 반복이 적용이 안됩니다. #407):
      • PrintTitleRows: a quoted sheet name; columns and rows together ($A:$B,$1:$2); columns only gives none.
      • A workbook with a hidden first sheet, a title, two heading rows as print titles and a page break: the title is one table without headers, and each of the two page tables starts with the 2 heading rows (20 + 20 body rows).
    • HpglPlotTests (Format request: .plt #410):
      • plain HP-GL lines and pen colours;
      • a printer driver's PJL-wrapped PE plot (square, pen change, move, 0.5 mm pen width);
      • circle, arc end point, filled polygon with a PC colour;
      • .plt → SVG (24 mm wide), PNG and PDF through the job queue;
      • a PostScript .plt fails with the reason.
    • PltFormatTests (Core): the format entry for .plt and .hpgl, and the schema 32 → 33 upgrade.

Screenshots (UI changes)

No UI changes.

Checklist

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files (none added)
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none)

Fixes #407. Fixes #410.

…n#407)

XLSX keeps its rows to repeat at the top (the _xlnm.Print_Titles name) and the HWPX tables start every page with them, as frozen rows did. Rows above the titles come once, before them.
HpglPlot reads HP-GL and HP-GL/2 (also the packed PE polylines printer drivers write, inside PJL / PCL) and draws the pen moves as SVG at real size; the vector engine renders PDF and images from there. Settings schema 33 teaches the vector donut .plt, .hpgl, .hpg and .hgl.

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cre8ive-marketing. The print titles part looks right to me: localSheetId counted with hidden sheets, rows above the titles once in their own table, and frozen rows exactly as before when there are no print titles. I ran the new tests locally (HpglPlotTests, the print-title tests, the tracing guard and PltFormatTests): all pass.

Two things on the plot reader:

  1. HP-GL/1 files that don't start with IN, BP, SP, PU, PA or DF are refused. I tried four valid plots and each failed with "No HP-GL drawing found":

    • device-control sequences first, as cutting plotters and older CAD drivers write them: ESC.(;ESC.I81;;17:ESC.N;19:IN;SP1;PU0,0;PD400,0,400,400;
    • IP0,0,4000,4000;SC;SP1;PU0,0;PD…
    • a leading ETX (\x03IN;…)
    • a comment first: CO"made by x";IN;…

    StartsWithHpgl only knows six commands, and every ESC jumps to the next ESC%…B, which an HP-GL/1 file never has. Please skip ESC . sequences (a single letter, or parameters ending in :) and accept any two-letter mnemonic at the start, with a test per case.

  2. Reference names. We don't name projects that were only read to check a format, so please drop the ezdxf mentions from the HpglPlot.cs header and the HpglPlotTests.cs header. Describing the PE encoding in your own words, as the DecodeNumbers summary already does, is enough.

Settings schema 33 and the TracingTests.IsTracing line shared with #401 we'll sort out when merging, as you suggested. CI for fork runs is waiting for approval; we'll start it.

Device-control sequences (ESC . …) are skipped, a CO comment's quoted text stays its argument, and any command may come first, so plots opening with ESC .(, IP / SC, ETX or a comment are read. The header no longer names the project only read to check PE.
@cre8ive-marketing

Copy link
Copy Markdown
Collaborator Author

@KnifeLemon Thanks for testing those plots. Both points are fixed in b3a8ce7:

  1. HP-GL/1 plots that start with any command
    • StartsWithHpgl is gone: parsing starts at the first byte, so any two-letter mnemonic may come first. Leading control characters such as ETX are skipped.
    • ESC . device-control sequences are skipped (DeviceControlEnd): one character after ESC ., plus its numeric parameters when they end in :, so ESC.(, ESC.I81;;17: and ESC.N;19: all go.
    • Any other escape still jumps to the next "enter HP-GL/2 mode" (ESC % … B), as for PJL/PCL wrappers. It now also checks the escape it stands on, not only later ones.
    • A quoted argument stays one argument, so CO"made by x; PD 9,9" is a comment and isn't drawn.
    • New Hpgl1_plots_starting_with_any_command_are_read, one case each (all give the same square):
      • your four plots: ESC.(;ESC.I81;;17:ESC.N;19:IN;…, IP0,0,4000,4000;SC;…, \x03IN;…, CO"…";IN;…
      • lower-case commands
    • A PostScript .plt still fails with the reason.
  2. Reference names: removed from the HpglPlot.cs and HpglPlotTests.cs headers and from the PR description. The PE encoding is described in DecodeNumbers only.

dotnet format --verify-no-changes is clean. Engines (1472) and Core (457) pass. The rest of the PR is unchanged.

@KnifeLemon KnifeLemon left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cre8ive-marketing, both points are covered. I ran the HP-GL, print title and spreadsheet tests on b3a8ce7 here (69 pass), and the four plots that were refused before now draw the same square.

Two small things we'll do on our side when merging, nothing needed from you: the settings migration gets the next free schema number (#351 also uses 33 and goes in first), and the strings for any language added in the meantime.

@KnifeLemon
KnifeLemon merged commit 98875db into KnifeLemon:main Oct 23, 2026
9 checks passed
KnifeLemon added a commit that referenced this pull request Oct 23, 2026
Merge #393, #432, #381 and #349 with their settings migrations renumbered
@KnifeLemon

Copy link
Copy Markdown
Owner

Merged through #464, thanks @cre8ive-marketing! Its settings migration became schema 35. It'll be in the next release.

KnifeLemon added a commit to cre8ive-marketing/Filee that referenced this pull request Oct 23, 2026
The HP-GL plot-file step becomes v35 after KnifeLemon#393's v34, AppSettings.CurrentSchemaVersion
goes to 35 and the migration test starts from 34. KnifeLemon#432 adds no UI strings; all 13
language files already match en.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon added a commit to cre8ive-marketing/Filee that referenced this pull request Oct 23, 2026
…ne text for fr, zh-TW, ne

The iCalendar step becomes v36 after KnifeLemon#432's v35, AppSettings.CurrentSchemaVersion goes
to 36 and the iCalendar migration test starts from 35.

engine.data.description now names iCalendar events in English; French and Traditional
Chinese still said vCard only, and Nepali had an older one-line text. All three now say
what the English one says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working formats New formats and engines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format request: .plt 엑셀-PDF 행 반복이 적용이 안됩니다.

2 participants