NOTE: I could not find the XL control in the dropdown above, and it wouldn't let me continue without selecting one, so I chose PDF Viewer, even though that's not the right one.
I've used NuGet to install XLIO and renderer.
I was able to create the workbook and download it per your example code.
But I want to convert the workbook to a pdf and download that instead.
When I type ExcelToPdfConverter, I get an error:
ExcelToPdfConverter is inaccessible due to its protection level
What am I missing?
I poked around and experimented and I now think your documentation for Blazor XL is inaccurate and incomplete -- or at least the sample code is wrong (maybe outdated?)/
Here's what worked for me:
//Save the document as a stream and return the stream.
XlsIORenderer renderer = new();
PdfDocument pdfDoc = new();
pdfDoc = renderer.ConvertToPDF(worksheet);
using ( MemoryStream stream = new MemoryStream() )
{
//Save the created Excel document to MemoryStream
//workbook.SaveAs(stream); // to save and download as Excel
pdfDoc.Save(stream);
return stream;
}
So, I guess I'm confused. My app is a Net Core app, so did I install the right NuGet packages?
I couldn't find anything in the documentation that explained the need for different code when in Core. The end result in my project is fantastic, but I gotta say it was a pretty frustrating experience figuring out how to make it work with the sample code and documentation.