-
Notifications
You must be signed in to change notification settings - Fork 302
Open
Labels
bugSomething isn't workingSomething isn't working
Description
EPPlus usage
Commercial use (I have a commercial license)
Environment
macos, linux
Epplus version
8.4.0
Spreadsheet application
Excel
Description
#!/usr/bin/env dotnet script
#r "nuget: EPPlus, 8.4.0"
// EPPlus Bug Repro: Font.Size returns 0 when inherited from Normal style
//
// This demonstrates inconsistent behavior:
// - Font.Name correctly resolves from scheme="minor" to the theme font name
// - Font.Size returns 0 when the cell's font doesn't explicitly set size (should inherit)
using OfficeOpenXml;
ExcelPackage.License.SetNonCommercialPersonal("Demo");
Console.WriteLine($"EPPlus Version: {typeof(ExcelPackage).Assembly.GetName().Version}\n");
// Use existing fixture that exhibits the bug
var path = "fixtures/Lista_de_empregados.xlsx";
var package = new ExcelPackage(new FileInfo(path));
var wb = package.Workbook;
var ws = wb.Worksheets[0];
Console.WriteLine("=== Fonts in styles.xml ===");
for (int i = 0; i < wb.Styles.Fonts.Count; i++)
{
var f = wb.Styles.Fonts[i];
Console.WriteLine($"Font[{i}]: Name=\"{f.Name}\", Size={f.Size}, Scheme=\"{f.Scheme}\"");
}
Console.WriteLine("\n=== Normal style (builtinId=0) ===");
var normalStyle = wb.Styles.NamedStyles.First(s => s.BuildInId == 0);
Console.WriteLine($"Font.Name: \"{normalStyle.Style.Font.Name}\"");
Console.WriteLine($"Font.Size: {normalStyle.Style.Font.Size}");
Console.WriteLine("\n=== Cell A1 ===");
var cell = ws.Cells["A1"];
Console.WriteLine($"Value: \"{cell.Value}\"");
Console.WriteLine($"Font.Name: \"{cell.Style.Font.Name}\" ← Resolved from scheme");
Console.WriteLine($"Font.Size: {cell.Style.Font.Size} ← BUG: Returns 0, should be 10");
Console.WriteLine($"Font.Scheme: \"{cell.Style.Font.Scheme}\"");
Console.WriteLine("\n=== Issue ===");
Console.WriteLine("Font[1] and Font[2] have no <sz> element in styles.xml.");
Console.WriteLine("Per ECMA-376, missing properties should inherit from cellStyleXfs (Normal style).");
Console.WriteLine("EPPlus resolves Font.Name from scheme, but returns 0 for Font.Size instead of inheriting.");
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog