Issue with the excel Xls file when tested in Aspose

Hi Team,

I tried adding the Xls file to Aspose checker and there was pop up stating converted into PDF and vanished within few seconds.

But I was unable to find the converted PDF document.

Please find the attached sample file.
Sample file.7z (2.1 KB)

@IDBSSupport

It sounds like you’re experiencing an issue with the conversion of your Excel file to PDF using Aspose. If the converted PDF document is not appearing after the conversion process, here are a few steps you can take to troubleshoot the issue:

  1. Check Output Directory: Ensure that you are looking in the correct output directory where the PDF is supposed to be saved. Sometimes, the default path may not be where you expect.

  2. Review Conversion Code: If you are using code to perform the conversion, double-check that the save method is correctly implemented. Here’s a simple example of how to convert an Excel file to PDF using Aspose.Cells:

    // Load the Excel file
    Workbook workbook = new Workbook("path/to/your/file.xls");
    
    // Save the workbook as a PDF
    workbook.Save("path/to/output/file.pdf", SaveFormat.Pdf);
    
  3. Check for Errors: Look for any exceptions or error messages that might be thrown during the conversion process. This can provide clues as to what might be going wrong.

  4. Update Aspose Library: Ensure that you are using the latest version of the Aspose.Cells library, as updates often include bug fixes and improvements.

  5. Test with a Different File: Try converting a different Excel file to see if the issue is specific to the file you are currently using.

If you follow these steps and still encounter issues, please provide any error messages or additional details about your setup. This information will help me assist you further. Thank you for your patience, and I look forward to resolving this issue for you!

@IDBSSupport
Would you like to provide your xls sample file and runnable test code? We will check it soon. Also, please check your antivirus software to see if the generated PDF file has been deleted by the antivirus software?

@John.He I have attached the sample in the description. Also no files were deleted in the system.
May I please ask you to let us know what is meant by " Runnable test code" ?

@IDBSSupport
Thank you for your feedback. There are only two xlsx files in the compressed file you provided. We need the xls file you mentioned to locate the issue.
Additionally, are you currently using an online conversion tool? If so, please provide your url.
If you are using the .net library, please provide runnable test code. We will check it soon.

@John.He apologies for the confusion caused.

We are not using any online tool.

Please find the attached test file
Sample file.7z (2.1 KB)

@IDBSSupport
The file with xls suffix you provided is not an Excel file. When loading the sample file, it is necessary to specify TxtLoadOptions. Please refer to the attachment. out_net.pdf (68.5 KB)

Please refer to the following example code to convert the file to PDF format.

TxtLoadOptions options = new TxtLoadOptions(LoadFormat.TabDelimited);
Workbook workbook = new Workbook(filePath + "250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xls", options);            
           
workbook.Save(filePath + "out_net.pdf");

Hope helps a bit.

@IDBSSupport,

I checked your files and your so called XLS and XLSX file(s) are of actually text (format) type and not native Excel files. For confirmation, you may open your file into some text editor (e.g., notepad) manually and you will see it is just a text file. When you just try to use the line of code via Aspose.Cells API, you will get an error: “The file format and extension do not match”.

Workbook workbook = new Workbook("d:\\files\\250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xls";
);

For your requirements, you have to load the file as text file format via Aspose.Cells’ LoadOptions. Please try the following sample code to load file and convert it to PDF. It will work fine and the output PDF (attached) will be generated fine.

String filePath = "d:\\files\\250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xls";
TxtLoadOptions options = new TxtLoadOptions(LoadFormat.TAB_DELIMITED);
// Load the file
Workbook workbook = new Workbook(filePath, options);

// Save the workbook as a PDF
workbook.save("d:\\files\\out1.pdf", SaveFormat.PDF);

out1.pdf (68.5 KB)

@amjad.sahi Thank you for the inputs.

I have an additional question — you mentioned that the file with the issue is in text format and not in native Excel format. However, when I simply convert the .xls file to .xlsx, the issue is no longer observed.

Could you please help me understand why this resolves the problem?

@IDBSSupport
If you directly change the xls suffix of the file to xlsx and use the cells library to load and convert xlsx file to pdf, you will get an exception “Aspose.Cells.CellsException: File is corrupted”.

How do you convert xls file to xlsx file?

@John.He Thank you for getting back to us.

We just open the problem file in the excel and save the file as .xlsx format.

Thanks!

@IDBSSupport
When you open a file in Excel and save it in XLSX format, the result file is already a correct Excel file. Of course, you can also use Aspose.Cells to complete this save operation. Please refer to the following example code.

TxtLoadOptions options = new TxtLoadOptions(LoadFormat.TabDelimited);
Workbook workbook = new Workbook(filePath + "250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xls", options);

workbook.Save(filePath + "250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xlsx");


Workbook book = new Workbook(filePath + "250521_AP000313096_CA125blocking_feasibility02_HSL2_import X.xlsx");
book.Save(filePath + "out_net.pdf");

Hope helps a bit.

@John.He thanks for the help, please close the ticket.

@IDBSSupport
You are welcome. If you have any questions, please feel free to contact us at any time.