Exception "This file's format is not supported or you don't specify a correct format." while loading XLS file

HI Amjad,

Thanks you for the files. We are validating new version. Meanwhile we came across other issues like Aspose is not able to convert attached excel file into spreadsheetml.


Aspose.Cells.Test

This file’s format is not supported or you don’t specify a correct format.

OK

code to convert is as below,

mXMLSpreadsheetFile += “Test.ss.xml”
Me.XLSFile = “O:\Prerak\EXEMPT NON EXEMPT DATA 401k Employees Paid in Year Jan-Dec 2017.xls REVISED2.xls"
mXMLSpreadsheetFile = GetValidExcelPathName(mXMLSpreadsheetFile)
Dim FileFormatInfo As FileFormatInfo = Aspose.Cells.FileFormatUtil.DetectFileFormat(Me.XLSFile)
If FileFormatInfo.LoadFormat = LoadFormat.Unknown AndAlso FileFormatInfo.FileFormatType = FileFormatType.Unknown Then
Using fileReader As StreamReader = New StreamReader(Me.mXLSFile)
EXEMPT NON EXEMPT DATA 401k Employees Paid in Year Jan-Dec 2017.xls REVISED2.zip (13.0 KB)

                Dim line() As String = fileReader.ReadLine().Split(CChar(vbTab))
                If line.Length > 1 Then
                    loadOptions = New Aspose.Cells.LoadOptions(LoadFormat.TabDelimited)
                Else
                    loadOptions = New Aspose.Cells.LoadOptions(LoadFormat.CSV)
                End If
            End Using
        ElseIf FileFormatInfo.LoadFormat = LoadFormat.Unknown AndAlso FileFormatInfo.FileFormatType <> FileFormatType.Unknown Then
            loadOptions = New LoadOptions(LoadFormat.Auto)
        Else
            loadOptions = New LoadOptions(FileFormatInfo.LoadFormat)

            'loadOptions.ConvertNumericData = False
        End If
        workBook = New Aspose.Cells.Workbook(Me.XLSFile, loadOptions)
        workBook.Settings.CalcMode = Aspose.Cells.CalcModeType.Manual
        For Each worksheet As Aspose.Cells.Worksheet In workBook.Worksheets
            worksheet.RemoveAutoFilter()
            'If loadOptions.LoadFormat = LoadFormat.TabDelimited OrElse loadOptions.LoadFormat = LoadFormat.CSV Then
            '    Dim worksheetName As String = IO.Path.GetFileNameWithoutExtension(Me.XLSFile)
            '    'Excel Supports worksheet name upto 31 characters only  
            '    If worksheetName.Length > 31 Then worksheetName = worksheetName.Substring(0, 31)
            '    worksheet.Name = worksheetName
            'End If
        Next
        'Save spreadsheet as XML file using automation
        Dim saveOptions As SpreadsheetML2003SaveOptions = New SpreadsheetML2003SaveOptions()
        saveOptions.LimitAsXls = False
        workBook.Save(mXMLSpreadsheetFile, SaveFormat.SpreadsheetML)
    Catch ex As CellsException
        MsgBox(ex.Message)
    Finally
    End Try

Please do needful.

@PrerakShah,

Thanks for your new query. As it is a separate issue, we have created a new thread for easy management.

We were able to observe the issue but we need to look into it more. Please not that issue is not with saving it as SpreadsheetML but loading this XLS file. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46306 - Exception "This file's format is not supported or you don't specify a correct format" while loading XLS file

@PrerakShah,

After evaluating your issue further we come to know that it is not an issue with the product rather your template XLS file is in older format (Excel 5.0/Excel 95) which is not supported by Aspose.Cells APIs. Please note Aspose.Cells supports BIFF8 or greater formats i.e. Excel 97 - Excel 2010/2016 , so you cannot read/write the Excel 95 or earlier file format. See the document with example and also check the “More Information” sub-topic to see the workaround:
FAQ|Documentation.