diff --git a/RdlEngine/Render/ExcelValet.cs b/RdlEngine/Render/ExcelValet.cs index 7f071c45..858b448d 100644 --- a/RdlEngine/Render/ExcelValet.cs +++ b/RdlEngine/Render/ExcelValet.cs @@ -486,7 +486,14 @@ void WriteStyles(ZipOutputStream zip) } sb.AppendLine(""); // output the font list - sb.AppendFormat("", _FontCache.Count); + // Excel requires at least one font to be defined + int fontCount = _FontCache.Count > 0 ? _FontCache.Count : 1; + sb.AppendFormat("", fontCount); + if (_FontCache.Count == 0) + { + // Add a default font if none exists + sb.AppendLine(""); + } foreach (string f in _FontCache) { sb.AppendLine(f); @@ -639,12 +646,22 @@ void WriteWorkbookRels(ZipOutputStream zip) ""); int id = 1; - foreach (SheetInfo sinfo in _Sheets) + if (_Sheets.Count == 0) { + // Add relationship for the empty sheet that will be created sb.AppendFormat("", id, sinfo.Name); + "Target=\"worksheets/sheet1.xml\"/>", id); id++; } + else + { + foreach (SheetInfo sinfo in _Sheets) + { + sb.AppendFormat("", id, sinfo.Name); + id++; + } + } sb.AppendFormat("