Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Excel page breaks in XLSX → PDF; LibreOffice for Word and Excel → PDF when chosen
KnifeLemonbce52a798184
diff --git a/src/Filee.App/App.axaml.cs b/src/Filee.App/App.axaml.csindex 1040b6b6..07e39e26 100644--- a/src/Filee.App/App.axaml.cs+++ b/src/Filee.App/App.axaml.cs@@ -167,9 +167,13 @@ public partial class App : Applicationif (ownCopiesChanged)EngineEnvironment.OwnCopies = new Dictionary<string, string>(settings.EngineOwnCopies);var routesChanged = EngineEnvironment.LibreOfficeForSlides != settings.LibreOfficeForSlides- || EngineEnvironment.LibreOfficeForHwp != settings.LibreOfficeForHwp;+ || EngineEnvironment.LibreOfficeForHwp != settings.LibreOfficeForHwp+ || EngineEnvironment.LibreOfficeForDocuments != settings.LibreOfficeForDocuments+ || EngineEnvironment.LibreOfficeForSheets != settings.LibreOfficeForSheets;EngineEnvironment.LibreOfficeForSlides = settings.LibreOfficeForSlides;EngineEnvironment.LibreOfficeForHwp = settings.LibreOfficeForHwp;+ EngineEnvironment.LibreOfficeForDocuments = settings.LibreOfficeForDocuments;+ EngineEnvironment.LibreOfficeForSheets = settings.LibreOfficeForSheets;var loc = AppHost.Get<LocalizationService>();if (loc.NeedsUpdate(settings.Language))diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.jsonindex 0508e507..d7dada74 100644--- a/src/Filee.App/Assets/i18n/en.json+++ b/src/Filee.App/Assets/i18n/en.json@@ -398,6 +398,10 @@"engines.lo_description": "Besides the formats only it reads, LibreOffice can take over conversions it does more faithfully. Without LibreOffice these switches change nothing.","engines.lo_slides": "Use LibreOffice for presentations → PDF","engines.lo_slides_hint": "PPTX, PPT and ODP keep their slide backgrounds and shape positions as in PowerPoint. Off: the built-in route, which needs no LibreOffice but can lose backgrounds and move shapes.",+ "engines.lo_documents": "Use LibreOffice for Word documents → PDF",+ "engines.lo_documents_hint": "DOCX, DOC, ODT and RTF are laid out as in Word, including Chinese and Japanese punctuation rules. Off: the built-in route, which needs no LibreOffice.",+ "engines.lo_sheets": "Use LibreOffice for spreadsheets → PDF",+ "engines.lo_sheets_hint": "XLSX, XLS, ODS and CSV are printed with the workbook's print area, page setup and page breaks, as Excel prints them. Off: the built-in route, which fits each sheet to the page width and keeps page breaks.","engines.lo_hwp": "Use LibreOffice for HWP·HWPX → PDF","engines.lo_hwp_hint": "Off by default: rhwp usually lays out HWP more like 한글. Turn it on when a document comes out wrong with rhwp (overlapping text, misplaced tables), then compare.","engines.package.libreoffice.name": "LibreOffice (older and rare formats)",diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.jsonindex 9fb135f1..7b3445ea 100644--- a/src/Filee.App/Assets/i18n/ko.json+++ b/src/Filee.App/Assets/i18n/ko.json@@ -398,6 +398,10 @@"engines.lo_description": "LibreOffice만 읽을 수 있는 형식 외에도, 더 정확하게 변환하는 작업을 맡길 수 있어요. LibreOffice가 없으면 아래 설정은 아무 영향이 없어요.","engines.lo_slides": "발표 자료 → PDF는 LibreOffice로 변환","engines.lo_slides_hint": "PPTX·PPT·ODP의 슬라이드 배경과 도형 위치가 파워포인트와 같게 나와요. 끄면 LibreOffice 없이 되는 내장 방식으로 변환하는데, 배경이 빠지거나 도형 위치가 달라질 수 있어요.",+ "engines.lo_documents": "Word 문서 → PDF는 LibreOffice로 변환",+ "engines.lo_documents_hint": "DOCX·DOC·ODT·RTF를 Word와 같은 배치로 변환해요. 중국어·일본어 문장부호 규칙도 지켜요. 끄면 LibreOffice 없이 되는 내장 방식으로 변환해요.",+ "engines.lo_sheets": "엑셀 → PDF는 LibreOffice로 변환",+ "engines.lo_sheets_hint": "XLSX·XLS·ODS·CSV를 통합 문서의 인쇄 영역, 페이지 설정, 페이지 나누기대로 엑셀처럼 인쇄해요. 끄면 내장 방식으로 시트를 페이지 너비에 맞추고, 페이지 나누기는 지켜요.","engines.lo_hwp": "한글(HWP·HWPX) → PDF는 LibreOffice로 변환","engines.lo_hwp_hint": "기본은 꺼져 있어요. 보통은 rhwp가 한글과 더 비슷하게 그려요. rhwp로 변환한 문서가 깨질 때(글자 겹침, 표 위치 어긋남) 켜서 비교해 보세요.","engines.package.libreoffice.name": "LibreOffice (오래되었거나 드문 형식)",diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.jsonindex f10a1c16..0ce05c26 100644--- a/src/Filee.App/Assets/i18n/zh-CN.json+++ b/src/Filee.App/Assets/i18n/zh-CN.json@@ -398,6 +398,10 @@"engines.lo_description": "除了只有它能读取的格式,还可以把它转换得更准确的工作交给 LibreOffice。没有安装 LibreOffice 时,下面的设置没有作用。","engines.lo_slides": "演示文稿 → PDF 使用 LibreOffice","engines.lo_slides_hint": "PPTX、PPT、ODP 的幻灯片背景和形状位置与 PowerPoint 一致。关闭后使用内置方式(不需要 LibreOffice),但背景可能丢失、形状位置可能改变。",+ "engines.lo_documents": "Word 文档 → PDF 使用 LibreOffice",+ "engines.lo_documents_hint": "DOCX、DOC、ODT、RTF 按 Word 的排版转换,也遵守中文和日文的标点规则。关闭后使用内置方式(不需要 LibreOffice)。",+ "engines.lo_sheets": "电子表格 → PDF 使用 LibreOffice",+ "engines.lo_sheets_hint": "XLSX、XLS、ODS、CSV 按工作簿的打印区域、页面设置和分页符打印,与 Excel 一致。关闭后使用内置方式,把工作表缩放到页面宽度,并保留分页符。","engines.lo_hwp": "HWP·HWPX → PDF 使用 LibreOffice","engines.lo_hwp_hint": "默认关闭:rhwp 的排版通常更接近韩文 Hangul。某个文档用 rhwp 转换出错(文字重叠、表格错位)时再打开对比。","engines.package.libreoffice.name": "LibreOffice(旧版和少见格式)",diff --git a/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs b/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.csindex 125d820c..dd1b810a 100644--- a/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/EnginesPageViewModel.cs@@ -54,6 +54,8 @@ public sealed partial class EnginesPageViewModel : ObservableObject, IDisposable_downloads = downloads;_libreOfficeForSlides = store.Settings.LibreOfficeForSlides;_libreOfficeForHwp = store.Settings.LibreOfficeForHwp;+ _libreOfficeForDocuments = store.Settings.LibreOfficeForDocuments;+ _libreOfficeForSheets = store.Settings.LibreOfficeForSheets;_catalog.Changed += OnCatalogChanged;Reload();}@@ -64,6 +66,12 @@ public sealed partial class EnginesPageViewModel : ObservableObject, IDisposable/// <summary>HWP / HWPX → PDF through LibreOffice and H2Orestart instead of rhwp.</summary>[ObservableProperty] private bool _libreOfficeForHwp;+ /// <summary>Word documents → PDF through LibreOffice instead of the built-in route.</summary>+ [ObservableProperty] private bool _libreOfficeForDocuments;++ /// <summary>Spreadsheets → PDF through LibreOffice instead of the built-in route.</summary>+ [ObservableProperty] private bool _libreOfficeForSheets;+partial void OnLibreOfficeForSlidesChanged(bool value){_store.Settings.LibreOfficeForSlides = value;@@ -76,6 +84,18 @@ public sealed partial class EnginesPageViewModel : ObservableObject, IDisposable_store.SaveSettings();}+ partial void OnLibreOfficeForDocumentsChanged(bool value)+ {+ _store.Settings.LibreOfficeForDocuments = value;+ _store.SaveSettings();+ }++ partial void OnLibreOfficeForSheetsChanged(bool value)+ {+ _store.Settings.LibreOfficeForSheets = value;+ _store.SaveSettings();+ }+/// <summary>Optional engines that are downloaded on demand.</summary>public IReadOnlyList<EnginePackageState> Packages => _downloads.Packages;diff --git a/src/Filee.App/Views/Pages/EnginesPage.axaml b/src/Filee.App/Views/Pages/EnginesPage.axamlindex a053a7ad..2c6b60bd 100644--- a/src/Filee.App/Views/Pages/EnginesPage.axaml+++ b/src/Filee.App/Views/Pages/EnginesPage.axaml@@ -77,6 +77,14 @@<ToggleSwitch IsChecked="{Binding LibreOfficeForSlides}" OnContent="{DynamicResource engines.lo_slides}" OffContent="{DynamicResource engines.lo_slides}" /><TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,0,0,4" Text="{DynamicResource engines.lo_slides_hint}" /></StackPanel>+ <StackPanel Spacing="2">+ <ToggleSwitch IsChecked="{Binding LibreOfficeForDocuments}" OnContent="{DynamicResource engines.lo_documents}" OffContent="{DynamicResource engines.lo_documents}" />+ <TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,0,0,4" Text="{DynamicResource engines.lo_documents_hint}" />+ </StackPanel>+ <StackPanel Spacing="2">+ <ToggleSwitch IsChecked="{Binding LibreOfficeForSheets}" OnContent="{DynamicResource engines.lo_sheets}" OffContent="{DynamicResource engines.lo_sheets}" />+ <TextBlock Classes="caption" TextWrapping="Wrap" Margin="0,0,0,4" Text="{DynamicResource engines.lo_sheets_hint}" />+ </StackPanel><StackPanel Spacing="2"><ToggleSwitch IsChecked="{Binding LibreOfficeForHwp}" OnContent="{DynamicResource engines.lo_hwp}" OffContent="{DynamicResource engines.lo_hwp}" /><TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource engines.lo_hwp_hint}" />diff --git a/src/Filee.Cli/CliHost.cs b/src/Filee.Cli/CliHost.csindex 98406d78..14bb8b43 100644--- a/src/Filee.Cli/CliHost.cs+++ b/src/Filee.Cli/CliHost.cs@@ -31,6 +31,8 @@ internal sealed class CliHost : IAsyncDisposableEngineEnvironment.OwnCopies = new Dictionary<string, string>(store.Settings.EngineOwnCopies);EngineEnvironment.LibreOfficeForSlides = store.Settings.LibreOfficeForSlides;EngineEnvironment.LibreOfficeForHwp = store.Settings.LibreOfficeForHwp;+ EngineEnvironment.LibreOfficeForDocuments = store.Settings.LibreOfficeForDocuments;+ EngineEnvironment.LibreOfficeForSheets = store.Settings.LibreOfficeForSheets;var converters = EngineRegistry.CreateAll(new EngineEnvironment(store.Directory));var catalog = new ConverterCatalog(converters) { Priority = store.Settings.EnginePriority };var queue = new JobQueue(catalog, EngineRegistry.FindPdfMerger(converters), combiner: EngineRegistry.FindFileCombiner(converters),diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.csindex ae84ebea..5db5dcfc 100644--- a/src/Filee.Core/Settings/AppSettings.cs+++ b/src/Filee.Core/Settings/AppSettings.cs@@ -126,6 +126,18 @@ public sealed class AppSettings/// </summary>public bool LibreOfficeForHwp { get; set; }+ /// <summary>+ /// With LibreOffice installed, Word documents (DOCX, DOC, ODT, RTF) → PDF go through it instead of the built-in+ /// route: Chinese punctuation and line-start rules, fonts the built-in route lacks.+ /// </summary>+ public bool LibreOfficeForDocuments { get; set; }++ /// <summary>+ /// With LibreOffice installed, spreadsheets (XLSX, XLS, ODS, CSV) → PDF go through it: print areas, page setup and+ /// page breaks as Excel prints them.+ /// </summary>+ public bool LibreOfficeForSheets { get; set; }+/// <summary>Every conversion keeps the created and modified dates of the original, whatever the preset says.</summary>public bool KeepFileDates { get; set; }diff --git a/src/Filee.Engines/Hwp/Hwpx/HwpxModel.cs b/src/Filee.Engines/Hwp/Hwpx/HwpxModel.csindex 4ec80293..7dc3dbdc 100644--- a/src/Filee.Engines/Hwp/Hwpx/HwpxModel.cs+++ b/src/Filee.Engines/Hwp/Hwpx/HwpxModel.cs@@ -127,6 +127,9 @@ internal sealed class HTable : HBlock/// <summary>Borders used where a cell does not define its own; null = thin solid grid.</summary>public HBorders? Borders { get; set; }+ /// <summary>The table starts a new page (a page break set in Excel).</summary>+ public bool PageBreakBefore { get; set; }+public List<HBlock> Caption { get; } = [];}diff --git a/src/Filee.Engines/Hwp/Hwpx/HwpxWriter.Body.cs b/src/Filee.Engines/Hwp/Hwpx/HwpxWriter.Body.csindex f4172498..16da0507 100644--- a/src/Filee.Engines/Hwp/Hwpx/HwpxWriter.Body.cs+++ b/src/Filee.Engines/Hwp/Hwpx/HwpxWriter.Body.cs@@ -335,7 +335,7 @@ internal sealed partial class HwpxWritervar runs = new RunBuilder();runs.Control(_base.CharPrId, sb.ToString(), isObject: true);- var paragraph = $"<hp:p id=\"0\" paraPrIDRef=\"{_base.ParaPrId}\" styleIDRef=\"{_base.StyleId}\" pageBreak=\"0\" columnBreak=\"0\" merged=\"0\">{leadingRun}{runs.Finish(_base.CharPrId, leadingRun is not null)}</hp:p>";+ var paragraph = $"<hp:p id=\"0\" paraPrIDRef=\"{_base.ParaPrId}\" styleIDRef=\"{_base.StyleId}\" pageBreak=\"{(table.PageBreakBefore ? 1 : 0)}\" columnBreak=\"0\" merged=\"0\">{leadingRun}{runs.Finish(_base.CharPrId, leadingRun is not null)}</hp:p>";return paragraph + string.Concat(table.Caption.Select(b => Block(b)));}diff --git a/src/Filee.Engines/Hwp/Hwpx/SheetDocument.cs b/src/Filee.Engines/Hwp/Hwpx/SheetDocument.csindex 789fedf6..179ee136 100644--- a/src/Filee.Engines/Hwp/Hwpx/SheetDocument.cs+++ b/src/Filee.Engines/Hwp/Hwpx/SheetDocument.cs@@ -66,10 +66,45 @@ internal static class SheetDocumentsection.Blocks.Add(title);}+ // Page breaks set in Excel start a new table on a new page; frozen header rows repeat at its top.+ var headerRows = sheet.FrozenRows is > 0 and <= 5 ? sheet.FrozenRows : 0;+ var header = rows.Where(r => r < headerRows).ToList();+ var body = rows.Where(r => r >= headerRows).ToList();+ var pages = new List<List<int>> { new(header) };+ var previous = -1;+ foreach (var r in body)+ {+ // A break above a hidden row still counts: the next visible row starts the page.+ if (pages[^1].Count > header.Count && sheet.RowBreaks.GetViewBetween(previous + 1, r).Count > 0)+ pages.Add(new List<int>(header));+ pages[^1].Add(r);+ previous = r;+ }+ for (var i = 0; i < pages.Count; i++)+ {+ var table = Table(sheet, pages[i], columns, headerRows, fontScale, widths.Select(w => Math.Max(300, (int)(w * scale))).ToArray());+ table.PageBreakBefore = i > 0;+ section.Blocks.Add(table);+ }++ if (cutRows || cutColumns)+ {+ var note = new HParagraph();+ note.Inlines.Add(new HText(+ $"… {sheet.Name}: {(cutRows ? $"first {MaxRows} rows" : "")}{(cutRows && cutColumns ? ", " : "")}{(cutColumns ? $"first {MaxColumns} columns" : "")} shown",+ new HCharFormat(Italic: true, Size: 900, Color: "#808080")));+ section.Blocks.Add(note);+ }+ return section;+ }++ /// <summary>One table of the given rows (one printed page or more), merged areas cut at its first and last row.</summary>+ private static HTable Table(Worksheet sheet, List<int> rows, List<int> columns, int headerRows, double fontScale, int[] widths)+ {var table = new HTable{ColumnCount = columns.Count,- ColumnWidths = widths.Select(w => Math.Max(300, (int)(w * scale))).ToArray(),+ ColumnWidths = widths,CellMargin = new HInsets(141, 141, 57, 57),Borders = new HBorders(GridLine, GridLine, GridLine, GridLine),};@@ -91,7 +126,6 @@ internal static class SheetDocumentcovered.Add((r, c));}- var headerRows = sheet.FrozenRows is > 0 and <= 5 ? sheet.FrozenRows : 0;foreach (var r in rows){var row = new HRow@@ -108,17 +142,7 @@ internal static class SheetDocument}table.Rows.Add(row);}- section.Blocks.Add(table);-- if (cutRows || cutColumns)- {- var note = new HParagraph();- note.Inlines.Add(new HText(- $"… {sheet.Name}: {(cutRows ? $"first {MaxRows} rows" : "")}{(cutRows && cutColumns ? ", " : "")}{(cutColumns ? $"first {MaxColumns} columns" : "")} shown",- new HCharFormat(Italic: true, Size: 900, Color: "#808080")));- section.Blocks.Add(note);- }- return section;+ return table;}private static HCell Cell(Worksheet sheet, int r, int c, int rowSpan, int colSpan, int column, double fontScale)diff --git a/src/Filee.Engines/Infrastructure/EngineEnvironment.cs b/src/Filee.Engines/Infrastructure/EngineEnvironment.csindex 20282298..77db4ef3 100644--- a/src/Filee.Engines/Infrastructure/EngineEnvironment.cs+++ b/src/Filee.Engines/Infrastructure/EngineEnvironment.cs@@ -60,6 +60,12 @@ public sealed class EngineEnvironment(string dataDirectory)/// <summary>LibreOffice converts HWP / HWPX to PDF instead of rhwp (Settings → Engines). Re-check after a change.</summary>public static bool LibreOfficeForHwp { get; set; }+ /// <summary>LibreOffice converts Word documents to PDF (Settings → Engines). Re-check after a change.</summary>+ public static bool LibreOfficeForDocuments { get; set; }++ /// <summary>LibreOffice converts spreadsheets to PDF (Settings → Engines). Re-check after a change.</summary>+ public static bool LibreOfficeForSheets { get; set; }+/// <summary>Programs required by each engine package on the current operating system.</summary>public static IReadOnlyDictionary<string, string[]> OwnCopyPrograms { get; } = Programs(OperatingSystem.IsWindows());diff --git a/src/Filee.Engines/Office/LibreOfficeConverter.cs b/src/Filee.Engines/Office/LibreOfficeConverter.csindex a1c1d83f..88fe61e5 100644--- a/src/Filee.Engines/Office/LibreOfficeConverter.cs+++ b/src/Filee.Engines/Office/LibreOfficeConverter.cs@@ -57,7 +57,8 @@ public sealed class LibreOfficeConverter : IConverter{_env = env;Locate();- Edges = BuildEdges(_hasHwpFilter, EngineEnvironment.LibreOfficeForSlides, EngineEnvironment.LibreOfficeForHwp);+ Edges = BuildEdges(_hasHwpFilter, EngineEnvironment.LibreOfficeForSlides, EngineEnvironment.LibreOfficeForHwp,+ EngineEnvironment.LibreOfficeForDocuments, EngineEnvironment.LibreOfficeForSheets);}public string Id => "libreoffice";@@ -68,7 +69,8 @@ public sealed class LibreOfficeConverter : IConverterpublic EngineStatus GetStatus(){Locate();- Edges = BuildEdges(_hasHwpFilter, EngineEnvironment.LibreOfficeForSlides, EngineEnvironment.LibreOfficeForHwp);+ Edges = BuildEdges(_hasHwpFilter, EngineEnvironment.LibreOfficeForSlides, EngineEnvironment.LibreOfficeForHwp,+ EngineEnvironment.LibreOfficeForDocuments, EngineEnvironment.LibreOfficeForSheets);return _soffice is null? EngineStatus.Unavailable("engine.reason.not_installed"): !EngineEnvironment.UsesFileesCopy("libreoffice")@@ -243,7 +245,9 @@ public sealed class LibreOfficeConverter : IConverter/// <param name="hwp">H2Orestart is installed (HWP / HWPX import).</param>/// <param name="slides">Presentations → PDF should go through LibreOffice (<see cref="EngineEnvironment.LibreOfficeForSlides"/>).</param>/// <param name="hwpToPdf">HWP / HWPX → PDF should go through LibreOffice (<see cref="EngineEnvironment.LibreOfficeForHwp"/>).</param>- internal static List<ConversionEdge> BuildEdges(bool hwp, bool slides, bool hwpToPdf)+ /// <param name="documents">Word documents → PDF should go through LibreOffice (<see cref="EngineEnvironment.LibreOfficeForDocuments"/>).</param>+ /// <param name="sheets">Spreadsheets → PDF should go through LibreOffice (<see cref="EngineEnvironment.LibreOfficeForSheets"/>).</param>+ internal static List<ConversionEdge> BuildEdges(bool hwp, bool slides, bool hwpToPdf, bool documents = false, bool sheets = false){var edges = new List<ConversionEdge>();void Add(IEnumerable<string> sources, IEnumerable<string> targets, int cost)@@ -261,8 +265,14 @@ public sealed class LibreOfficeConverter : IConverter// Chosen in Settings → Engines: cheap enough to beat the built-in route even at the bottom of the engine list// (its priority adds at most 9; PPTX → HWPX → PDF costs about 32, rhwp's HWP → PDF about 13).const int Preferred = 0;- Add(Writer, [.. Writer, "pdf", "txt", "html"], Fallback);- Add(Calc, [.. Calc, "pdf", "html"], Fallback);+ // Word and spreadsheet sources the built-in route also reads: cheap enough to win for the file itself (10 + 9+ // against about 31 through the HWPX writer and rhwp), not as a hop for other formats, which the DOCX writer can+ // turn into DOCX (Excel → DOCX → LibreOffice would cost 17 + 19).+ const int Chosen = 10;+ Add(Writer, [.. Writer, "txt", "html"], Fallback);+ Add(Writer, ["pdf"], documents ? Chosen : Fallback);+ Add(Calc, [.. Calc, "html"], Fallback);+ Add(Calc, ["pdf"], sheets ? Chosen : Fallback);Add(Impress, Impress, Fallback);Add(Impress, ["pdf"], slides ? Preferred : Fallback);Add(["txt", "html"], ["docx", "odt", "pdf"], Fallback + 3);diff --git a/src/Filee.Engines/Office/Sheets/Workbook.cs b/src/Filee.Engines/Office/Sheets/Workbook.csindex 30fbae36..b00d0689 100644--- a/src/Filee.Engines/Office/Sheets/Workbook.cs+++ b/src/Filee.Engines/Office/Sheets/Workbook.cs@@ -34,6 +34,9 @@ internal sealed class Worksheet(string name)/// <summary>Rows frozen at the top (usually headers): repeated on every printed page.</summary>public int FrozenRows { get; set; }+ /// <summary>0-based rows that start a new printed page (page breaks set in Excel: Page Layout → Breaks).</summary>+ public SortedSet<int> RowBreaks { get; } = [];+public void Set(int row, int column, SheetCell cell){if (!Rows.TryGetValue(row, out var cells))diff --git a/src/Filee.Engines/Office/Sheets/XlsxReader.cs b/src/Filee.Engines/Office/Sheets/XlsxReader.csindex dbb12776..713ae38d 100644--- a/src/Filee.Engines/Office/Sheets/XlsxReader.cs+++ b/src/Filee.Engines/Office/Sheets/XlsxReader.cs@@ -216,6 +216,11 @@ internal sealed class XlsxReaderforeach (var merge in xml.Element(S + "mergeCells")?.Elements(S + "mergeCell") ?? [])if (CellRange.Parse((string?)merge.Attribute("ref")) is { } range && (range.Bottom > range.Top || range.Right > range.Left))sheet.Merges.Add(range);++ // <brk id="20"/>: the break is above 0-based row 20, which starts the next page.+ foreach (var brk in xml.Element(S + "rowBreaks")?.Elements(S + "brk") ?? [])+ if (int.TryParse((string?)brk.Attribute("id"), out var breakRow) && breakRow > 0)+ sheet.RowBreaks.Add(breakRow);return sheet;}diff --git a/tests/Filee.Engines.Tests/HwpxReaderTests.cs b/tests/Filee.Engines.Tests/HwpxReaderTests.csindex a4f0afa9..9b44da77 100644--- a/tests/Filee.Engines.Tests/HwpxReaderTests.cs+++ b/tests/Filee.Engines.Tests/HwpxReaderTests.cs@@ -294,6 +294,36 @@ public class HwpxReaderTests(EngineFixture fx) : IClassFixture<EngineFixture>Assert.True(read.Sections[1].Page!.Landscape);}+ [Fact]+ public void Excel_page_breaks_start_a_new_page_with_the_header_rows_again()+ {+ // Issue #67: page breaks set in Excel were ignored by XLSX → PDF.+ var xlsx = new XlsxBuilder();+ xlsx.Sheet("목록",+ XlsxBuilder.Row(1, xlsx.Text("A1", "번호", XlsxBuilder.Header)) ++ string.Concat(Enumerable.Range(2, 8).Select(r => r == 7+ ? "<row r=\"7\" hidden=\"1\"><c r=\"A7\"><v>6</v></c></row>"+ : XlsxBuilder.Row(r, XlsxBuilder.Number($"A{r}", r - 1)))),+ before: "<sheetViews><sheetView workbookViewId=\"0\"><pane ySplit=\"1\" topLeftCell=\"A2\" activePane=\"bottomLeft\" state=\"frozen\"/></sheetView></sheetViews>",+ after: "<rowBreaks count=\"2\" manualBreakCount=\"2\"><brk id=\"4\" max=\"16383\" man=\"1\"/><brk id=\"6\" max=\"16383\" man=\"1\"/></rowBreaks>");+ var book = XlsxReader.Read(xlsx.Save(Path.Combine(fx.NewFolder(), "목록.xlsx")));+ Assert.Equal([4, 6], book.Sheets[0].RowBreaks);++ var source = SheetDocument.Build(book);++ // Rows 2-4 | 5-6 | 8-9: the break above the hidden row 7 starts the page at row 8.+ var tables = source.Sections[0].Blocks.OfType<HTable>().ToList();+ Assert.Equal([false, true, true], tables.Select(t => t.PageBreakBefore));+ Assert.Equal([4, 3, 3], tables.Select(t => t.Rows.Count));+ Assert.All(tables, t => Assert.True(t.Rows[0].Header));+ var dir = fx.NewFolder();+ var hwpx = Path.Combine(dir, "목록.hwpx");+ HwpxWriter.Write(source, hwpx);+ using var zip = System.IO.Compression.ZipFile.OpenRead(hwpx);+ using var reader = new StreamReader(zip.GetEntry("Contents/section0.xml")!.Open());+ Assert.Equal(2, System.Text.RegularExpressions.Regex.Count(reader.ReadToEnd(), "pageBreak=\"1\""));+ }+[Fact]public void Presentations_survive_the_way_through_hwpx(){diff --git a/tests/Filee.Engines.Tests/LibreOfficeRouteTests.cs b/tests/Filee.Engines.Tests/LibreOfficeRouteTests.csindex f41be7c9..d6f86848 100644--- a/tests/Filee.Engines.Tests/LibreOfficeRouteTests.cs+++ b/tests/Filee.Engines.Tests/LibreOfficeRouteTests.cs@@ -10,9 +10,9 @@ namespace Filee.Engines.Tests;public class LibreOfficeRouteTests(EngineFixture fx) : IClassFixture<EngineFixture>{/// <summary>The built-in engines with a LibreOffice that is installed (with H2Orestart), whatever this PC has.</summary>- private RoutePlanner Planner(bool slides, bool hwpToPdf)+ private RoutePlanner Planner(bool slides, bool hwpToPdf, bool documents = false, bool sheets = false){- var libreOffice = new InstalledLibreOffice(LibreOfficeConverter.BuildEdges(hwp: true, slides, hwpToPdf));+ var libreOffice = new InstalledLibreOffice(LibreOfficeConverter.BuildEdges(hwp: true, slides, hwpToPdf, documents, sheets));var converters = fx.Converters.Where(c => c.Id != "libreoffice").Append(libreOffice).ToList();var priority = new AppSettings().EnginePriority;return new RoutePlanner(converters, c => Math.Min(priority.IndexOf(c.Id) is >= 0 and var i ? i : priority.Count, 9));@@ -46,6 +46,32 @@ public class LibreOfficeRouteTests(EngineFixture fx) : IClassFixture<EngineFixtuAssert.Equal("libreoffice", Assert.Single(Planner(slides: true, hwpToPdf: true).Plan(from, "pdf")!.Steps).Converter.Id);}+ [Theory]+ [InlineData("docx")]+ [InlineData("xlsx")]+ public void Word_and_excel_go_the_built_in_way_unless_libreoffice_is_chosen(string from)+ {+ // Issue #66 (Chinese punctuation in DOCX) and #67 (Excel print setup): a choice in Settings → Engines.+ Assert.Equal(["hwpx-writer", "rhwp"], Planner(slides: true, hwpToPdf: false).Plan(from, "pdf")!.Steps.Select(s => s.Converter.Id));++ var chosen = from == "docx" ? Planner(slides: true, hwpToPdf: false, documents: true) : Planner(slides: true, hwpToPdf: false, sheets: true);+ Assert.Equal("libreoffice", Assert.Single(chosen.Plan(from, "pdf")!.Steps).Converter.Id);+ }++ [Fact]+ public void Each_choice_moves_only_its_own_formats()+ {+ var documents = Planner(slides: false, hwpToPdf: false, documents: true);+ Assert.Equal(["hwpx-writer", "rhwp"], documents.Plan("xlsx", "pdf")!.Steps.Select(s => s.Converter.Id));+ Assert.Equal(["hwpx-writer", "rhwp"], documents.Plan("pptx", "pdf")!.Steps.Select(s => s.Converter.Id));+ Assert.Equal("rhwp", Assert.Single(documents.Plan("hwp", "pdf")!.Steps).Converter.Id);+ Assert.Equal(["hwpx-writer", "rhwp"], documents.Plan("md", "pdf")!.Steps.Select(s => s.Converter.Id));++ var sheets = Planner(slides: false, hwpToPdf: false, sheets: true);+ Assert.Equal(["hwpx-writer", "rhwp"], sheets.Plan("docx", "pdf")!.Steps.Select(s => s.Converter.Id));+ Assert.Equal(["hwpx-writer", "rhwp"], sheets.Plan("tsv", "pdf")!.Steps.Select(s => s.Converter.Id));+ }+private sealed class InstalledLibreOffice(IReadOnlyList<ConversionEdge> edges) : IConverter{public string Id => "libreoffice";