Free Support Forum - aspose.com

Export to Excel => popup about wrong file format appears and Excel document formatting issues

Hi Aspose team,

when I try to export PDF document to Excel:

        DateTime Start = DateTime.Now;
        try
        {
            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string FileName = saveFileDialog1.FileName;

                //Open document
                Document pdfDocument = new Document(FileName);
                // instantiate ExcelSave Option object

                Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions();

                excelsave.UniformWorksheets = true;

                pdfDocument.Save("c:\\temp\\html\\ToExcel.xls", excelsave);
                MessageBox.Show((DateTime.Now - Start).ToString());
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

and then later try to open document I am getting:

“The file format and extension of “” does not match…”

If I export to file with XML extension then I cannot open this document by double click.
Exported file is attached.

Also second question - in original PDF I have formatting of tables (header has different color), in exported document formatting is gone.

I attached also original PDF document.

Thanks for help,
Oliver

Hi Oliver,

dr_oli:
Hi Aspose team,

when I try to export PDF document to Excel:


DateTime Start = DateTime.Now;
try
{
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string FileName = saveFileDialog1.FileName;
//Open document
Document pdfDocument = new Document(FileName);
// instantiate ExcelSave Option object
Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions();
excelsave.UniformWorksheets = true;
pdfDocument.Save(“c:\temp\html\ToExcel.xls”, excelsave);
MessageBox.Show((DateTime.Now - Start).ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

and then later try to open document I am getting:

“The file format and extension of “” does not match…”

If I export to file with XML extension then I cannot open this document by double click.
Exported file is attached.


Please note It is expected behavior, as this message appeared because Aspose.Pdf provides saving in MS Excel 2003 XML format. When you save output files as .xls file extension, it is correct for lower versions of MS Excel. To avoid this warning message in MS Excel version 2007 and higher without any warning messages we can save output file as xml extension to xml.


Moreover, I can open your shared .xml output file with double click in MS Excel 2007. Can you please share your environment details so we can investigate it further.


Best Regards,


Hi Oliver

dr_oli:
Also second question - in original PDF I have formatting of tables (header has different color), in exported document formatting is gone.

I attached also original PDF document.


Thanks for your inquiry. We have noticed the reported issue and logged PDFNEWNET-38937 it in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,