using ClosedXML.Excel;
class XLSXWriter : BExporter
{
private readonly string _fName;
public XLSXWriter(string fileName)
{
_fName = fileName;
}
public override void Export(IEnumerable<AnimalData> animals)
{
var workBook = new XLWorkbook(); <---Throws an exception
var workSheet = workBook.Worksheets.Add("MySheet");
workSheet.Cell("A1").Value = "Hello World";
FileStream fs = new FileStream(_fName, FileMode.Create);
workBook.SaveAs(fs);
fs.Close();
}
}
Just trying this library ClosedXML.dll, and it throws an exception can't figure out what could be the problem.
I get the _fName from the savefiledialog.
Ideas anybody?
Thought would delete this post, but might help someone in future....All i had to do was reference one more DLL DocumentFormat.OpenXml.dll . Works perfectly now!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With