Date OleAut invalid

Nov 9, 2010 at 10:51 PM

Hello, I'm trying to use an Excel spreadsheet template and when I try to retrieve the worksheet appears the error: "Date OLEAUT invalid". The code used is:

bool exportou = false;
string path = Constante.PathArquivosTemplateRelatorios + "template.xlsx";
FileInfo template = new FileInfo(path);

if (template.Exists == true)
    using (ExcelPackage p = new ExcelPackage(template, true))
        int startRow = 2;

        ExcelWorksheet ws = p.Workbook.Worksheets[1];
        int row = startRow;

//Population data...

        //Get the documet as a byte array from the stream and save it to disk.
        Byte[] bin = p.GetAsByteArray();

        string file = Constante.PathArquivosTemplateRelatorios + "\\sample4.xlsx";
        File.WriteAllBytes(file, bin);
        exportou = true;

Does anyone know what happens?

Nov 10, 2010 at 3:48 PM

I have to look at your file to see whats wrong. Create an issue and upload it or send me notification if you want to send it by mail.


Nov 10, 2010 at 9:41 PM

Hi, ok I do not know what is wrong with the file. An important is that the template file was generated on another machine. To solve my problem I generated a new file template from scratch and give the error no longer appeared.

Paulo Moreira