Error on workbook saveAs(string)

Dec 17, 2012 at 12:17 PM

Hello.

I have problem with saving xlsx file. I have written class which creates xlsx file, writes some data to it and then saves it - method: workbook.SaveAs(path). The problem is that when i use class in WinForms application it works fine, when I run this class from console application it fails. At my saveAs line application shuts down (without any error raised) and I see that empty file is created.

Any help?

Dec 17, 2012 at 12:46 PM

I'm guessing your code looks like this:

void MyForm(string path)
{
    XLWorkbook wb = new XLWorkbook();

    FillWorkbook(wb);

    wb.SaveAs(path);
}

void MyConsole(string path)
{
    XLWorkbook wb = new XLWorkbook();

    wb.SaveAs(path);
}

If that's the case: You simply forgot to add any data to your workbook.