We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exception: "This file's format is not supported or you don't specify a correct format"

Hi,
We are using Aspose Cells to convert file with extension “.xls” to PDFA.
When we create an instance of Workbook (new Workbook(stream)), the exception is raised “This file’s format is not supported or you don’t specify a correct format.”.
I’ve attached the file, which we are converting. test.7z (137 Bytes)
Is there any way to convert that file to PDFA?
Thank you in advance.

@gomezw,

Thanks for the sample file.

I checked your file and found your so called XLS file is not native XLS file format, rather is a text (Tab Delimited) file. You may simply open the file into notepad and confirm that it is just a text file. So, you got to specify the load options or LoadFormat when loading the file into Workbook object model. See the following sample code that works fine as I tested:
e.g.
Sample code:

byte[] bytes = File.ReadAllBytes(@"e:\\test2\\test.xls");
Stream stream = new MemoryStream(bytes);

Workbook workbook = new Workbook(stream, new LoadOptions(LoadFormat.TabDelimited));
.....

Let us know if you still have any issue or confusion.

Thank you for the quick response.

I tested this code and I didn’t get an error. But converted pdf is empty. I attached the result of conversion convertedXLS.pdf (4.6 KB)

@gomezw,

It works absolutely fine on my end. I am using Aspose.Cells for .NET v22.3 (please try it). Here is may sample code using your template file:
e.g
Sample code:

            byte[] bytes = File.ReadAllBytes(@"e:\\test2\\test.xls");
            Stream stream = new MemoryStream(bytes);

            Workbook workbook = new Workbook(stream, new LoadOptions(LoadFormat.TabDelimited));
            PdfSaveOptions options = new PdfSaveOptions();
            options.Compliance = PdfCompliance.PdfA1a;
            workbook.Save("e:\\test2\\out1.pdf", options);

Please find attached the output PDF file for your reference. Moreover, please make sure at least Arial font is installed on your machine before processing the sample code.
out1.pdf (22.6 KB)

After upgrading Aspose.Cells to v22.3 it finally works.

Thanks for your help

@gomezw,

Good to know that your issue is resolved by the new version/fix. Feel free to write us back if you have further queries or issue, we will be happy to assist you soon.