Skip to content

Commit ac58e32

Browse files
committed
Remove obsolete PDF test files from MiniPdf.Scripts/pdf_output directory
1 parent ab748e0 commit ac58e32

99 files changed

Lines changed: 1242 additions & 31 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
- English
2-
- .NET security policy
2+
- .NET security policy
3+
4+
## Issue Summary Workflow
5+
When user says "summary on issue #N", use `gh issue comment N --body-file -`
6+
to post a summary of completed work to the GitHub issue.

Run-Benchmark.ps1

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<#
2+
.SYNOPSIS
3+
One-click benchmark: generate Excel → convert to PDF (MiniPdf + LibreOffice) → compare → report.
4+
5+
.DESCRIPTION
6+
This script orchestrates the full MiniPdf self-evolution pipeline on Windows.
7+
It installs Python dependencies, runs all steps, and opens the final report.
8+
9+
.EXAMPLE
10+
.\Run-Benchmark.ps1
11+
.\Run-Benchmark.ps1 -CompareOnly
12+
.\Run-Benchmark.ps1 -SkipReference
13+
#>
14+
15+
param(
16+
[switch]$CompareOnly,
17+
[switch]$SkipGenerate,
18+
[switch]$SkipMiniPdf,
19+
[switch]$SkipReference,
20+
[switch]$SkipInstall
21+
)
22+
23+
$ErrorActionPreference = "Continue"
24+
$ScriptRoot = $PSScriptRoot
25+
$BenchmarkDir = Join-Path $ScriptRoot "tests" "MiniPdf.Benchmark"
26+
27+
Write-Host "`n============================================================" -ForegroundColor Cyan
28+
Write-Host " MiniPdf Self-Evolution Benchmark Pipeline" -ForegroundColor Cyan
29+
Write-Host "============================================================`n" -ForegroundColor Cyan
30+
31+
# Step 0: Install Python dependencies
32+
if (-not $SkipInstall) {
33+
Write-Host "[Step 0] Installing Python dependencies..." -ForegroundColor Yellow
34+
pip install openpyxl pymupdf --quiet 2>$null
35+
if ($LASTEXITCODE -ne 0) {
36+
Write-Host " WARNING: pip install had issues. Continuing anyway..." -ForegroundColor DarkYellow
37+
} else {
38+
Write-Host " OK" -ForegroundColor Green
39+
}
40+
}
41+
42+
# Build args for Python pipeline
43+
$pyArgs = @()
44+
if ($CompareOnly) { $pyArgs += "--compare-only" }
45+
if ($SkipGenerate) { $pyArgs += "--skip-generate" }
46+
if ($SkipMiniPdf) { $pyArgs += "--skip-minipdf" }
47+
if ($SkipReference) { $pyArgs += "--skip-reference" }
48+
49+
# Run the benchmark pipeline
50+
Write-Host "`n[Running] python run_benchmark.py $($pyArgs -join ' ')`n" -ForegroundColor Yellow
51+
Push-Location $BenchmarkDir
52+
try {
53+
python run_benchmark.py @pyArgs
54+
} finally {
55+
Pop-Location
56+
}
57+
58+
# Open the report if it exists
59+
$reportPath = Join-Path $BenchmarkDir "reports" "comparison_report.md"
60+
if (Test-Path $reportPath) {
61+
Write-Host "`n[Done] Report: $reportPath" -ForegroundColor Green
62+
Write-Host "Opening report..." -ForegroundColor Cyan
63+
# Open in VS Code if available, otherwise notepad
64+
$code = Get-Command code -ErrorAction SilentlyContinue
65+
if ($code) {
66+
code $reportPath
67+
} else {
68+
Start-Process notepad.exe -ArgumentList $reportPath
69+
}
70+
} else {
71+
Write-Host "`nNo report generated. Check the output above for errors." -ForegroundColor Red
72+
}

src/MiniPdf/ExcelReader.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,27 @@ private static List<List<ExcelCell>> ReadSheet(ZipArchiveEntry entry, List<strin
223223
var doc = XDocument.Load(stream);
224224
var ns = doc.Root?.GetDefaultNamespace() ?? XNamespace.None;
225225

226+
var lastRowNumber = 0;
227+
226228
foreach (var row in doc.Descendants(ns + "row"))
227229
{
230+
// Parse the row number to detect gaps (sparse rows)
231+
var rowNumAttr = row.Attribute("r")?.Value;
232+
if (int.TryParse(rowNumAttr, out var rowNumber))
233+
{
234+
// Insert empty rows for any gaps
235+
while (lastRowNumber + 1 < rowNumber)
236+
{
237+
rows.Add(new List<ExcelCell>());
238+
lastRowNumber++;
239+
}
240+
lastRowNumber = rowNumber;
241+
}
242+
else
243+
{
244+
lastRowNumber++;
245+
}
246+
228247
var cells = new List<ExcelCell>();
229248
var lastColIndex = 0;
230249

0 commit comments

Comments
 (0)