I am evaluating the PDF to XLS feature (using a temp 30 day license) and while it produces an XLS file, I get a message “The file you are trying to open … is in a different format than specified by the file extension” when I try to open the result in Excel.
We have further investigated the issue and would like to update you that it is not a bug of Aspose.Pdf. It is expected behavior, as this message appeared because Aspose.Pdf provides saving in MS Excel 2003 XML format. While user code uses .xls file extension for output file, it is correct for lower versions of MS Excel. Versions MS Excel 2007 and higher expect .xls file extension for binary document of lower versions Excel, and *.xml for XML that.
If you save an Excel document as xml with .xls extension in MS Excel 2003, and then try open it in MS Excel version 2007 or higher this results warning message described. To avoid this warning message you can change output file extension to xml and may open opened in MS Excel version 2007 and higher without any warning messages.
// load PDF document<o:p></o:p>
doc = new Aspose.Pdf.Document(myDir
// instantiate ExcelSave Option object<o:p></o:p>
excelsave = new ExcelSaveOptions();<o:p></o:p>
excelsave.UniformWorksheets = true;<o:p></o:p>
// save the output in XLS format<o:p></o:p>
doc.Save(myDir + “PDFtoExcel2007.xml”,
Please feel free to contact us for any further assistance.
Thanks Tilal. Thanks for the workaround, but it really is not a solution. I see now that the file is saved as an XML spreadsheet and not native XLS.
ricjamnev:Changing the extension to XML gets rid of the message (see attached) but the file is no longer associated with Excel so the user has to keep track of this themselves. I experimented and found that by inserting the the following line actually associates the file and makes the process more palatable as Excel will open the file by default:<?mso-application progid="Excel.Sheet"?>My new question is this: Do you see any problem with simply inserting this line after generating the XML file? If not, why can't this be included as an option and done automatically by the Aspose.Pdf component?We have logged an enhancement ticket PDFNEWNET-37425 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue.Best Regards,