My company is evaluating Spire.XLS as a replacement for GemBox.Spreadsheet. I am hitting an issue that I have not been able to turn up an answer for with searching.
Here's a trimmed down example of my code:
- Code: Select all
public IActionResult GetExcel()
{
var workBook = new Workbook();
var workSheetDetail = workBook.Worksheets.Add("Details");
workSheetDetail[1, 1].Value = "Total:";
workSheetDetail[1, 1].Style.Font.IsBold = true;
workSheetDetail.AllocatedRange.AutoFitColumns(); // this line throws the "cannot found font" exception
using (var stream = new MemoryStream())
{
workbook.SaveToStream(stream, FileFormat.Version2016); // if I leave off AutoFitColumns, this line throws the exception
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "demo.xlsx");
}
}
Do I have to load a font from disk? If so, is there example code somewhere for that?
Thanks