Bug 148662 - Libre is throwing error if .xls file is renamed to .xlsx
Summary: Libre is throwing error if .xls file is renamed to .xlsx
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/libre-i...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-19 06:30 UTC by Vikas
Modified: 2022-04-20 14:16 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
This is .xlsx file, which gives an error while running with given command. (164.00 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2022-04-19 06:31 UTC, Vikas
Details
.xls file which gets translated successfully. (164.00 KB, application/vnd.ms-excel)
2022-04-19 06:32 UTC, Vikas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vikas 2022-04-19 06:30:13 UTC
Description:
I am using the following command to to convert .xls file to pdf:

soffice.com --headless --convert-to pdf “D:\InputFiles\word2pdf\input.xls” --outdir D:\InputFiles\word2pdf

The above command is successfully converting that file to pdf. But when I am changing its extension to .xlsx and executing the same command getting an error.

Any idea why it is happening? Both files are opening in LibreOffice.

Steps to Reproduce:
1.Use the command provided in the description to translate both the files
2.
3.

Actual Results:
it should translate .xlsx file 

Expected Results:
Translation for .xlsx file failed.


Reproducible: Always


User Profile Reset: No



Additional Info:
Both the files are opening in Libre
Comment 1 Vikas 2022-04-19 06:31:18 UTC
Created attachment 179654 [details]
This is .xlsx file, which gives an error while running with given command.
Comment 2 Vikas 2022-04-19 06:32:32 UTC
Created attachment 179655 [details]
.xls file which gets translated successfully.
Comment 3 Mike Kaganski 2022-04-19 07:05:33 UTC
(In reply to Vikas from comment #0)
> Both the files are opening in Libre

(In reply to Vikas from comment #1)
> Created attachment 179654 [details]

(In reply to Vikas from comment #2)
> Created attachment 179655 [details]

The two attachments are identical (indeed, as you indicated that you just renamed the extension). However, they *both* can't be opened here using both Excel 2016, and LibreOffice (neither 7.2, nor 7.3) - they are nor XLS, nor XLSX files.

When you open the XLS file, and immediately try to Save As, what is the file type that is suggested in the File Save dialog?
Comment 4 Vikas 2022-04-19 15:43:40 UTC
If both files are neither XLS nor XLSX then why Libre is converting it into PDF? Libre should throw an error.

When I am trying Save As for XLS file, the file save dialog is suggesting .csv format.
Comment 5 Mike Kaganski 2022-04-19 15:59:43 UTC
(In reply to Vikas from comment #4)
> If both files are neither XLS nor XLSX then why Libre is converting it into
> PDF? Libre should throw an error.

It does here with the files you supplied.
> 
> When I am trying Save As for XLS file, the file save dialog is suggesting
> .csv format.

I am sure then that you have sent different files, not the ones that you used locally for conversion.
Comment 6 Mike Kaganski 2022-04-19 16:10:25 UTC
Trying to guess with assumption that the attached documents are not the correct ones.

(In reply to Vikas from comment #4)
> When I am trying Save As for XLS file, the file save dialog is suggesting
> .csv format.

This means that you are working with some CSV files that are renamed to XLS (and XLSX). CSV files are basically just plain text files, that have specific structure allowing to parse them as structured tabular data. We have a special rule in our import to allow text files with XLS extension to be opened in Calc. But not for CSV files disguised as XLSX; this means that when you open such a "pseudo-XLSX", you would usually open it in Writer.

But:

(In reply to Vikas from comment #0)
> Both the files are opening in Libre

This is likely because you try to open the pseudo-XLSX from Calc already open, in which case, current module (Calc) is taken into account (this is also true for RTF and HTML files, by the way). But if I'm correct, then trying to open such XLSX from your file manager, or from LibreOffice with no Calc document open, you would get it opened in Writer.

(In reply to Vikas from comment #0)
> But when I am changing its extension to .xlsx and executing the same command
> getting an error.

And this is confusing. There should not be errors, if the above is a correct guess. Simply the PDF should be from Writer, not from Calc.
Comment 7 LeroyG 2022-04-19 21:16:16 UTC
The shared file seems to be an UGS type one.
"UGS" could be for Universal-G-Code-Sender?
Comment 8 Vikas 2022-04-20 12:38:40 UTC
Hi All,

Let me explain everything properly.

I had one 3D .prt file which I renamed and just changed its extension to .xls and .xlsx. Out of which .xls is getting translated( ideally it should fail). And .xlsx file is failing with an error "Source file could not be loaded".

I just want to understand this scenario. As both files are invalid and should not be translated by Libre.
Comment 9 Mike Kaganski 2022-04-20 12:49:35 UTC
(In reply to Vikas from comment #8)
> I had one 3D .prt file which I renamed and just changed its extension to
> .xls and .xlsx. Out of which .xls is getting translated( ideally it should
> fail). 

Could you please attach the resulting PDF of such conversion?
Comment 10 Mike Kaganski 2022-04-20 12:55:45 UTC
(In reply to Vikas from comment #0)
> Both the files are opening in Libre

Also please attach a screenshot how the XLSX looks like when opened in LO.
Comment 11 Mike Kaganski 2022-04-20 13:03:03 UTC
(In reply to Vikas from comment #8)
> I just want to understand this scenario.

Also please clarify, what is your goal. You have filed a *bug report* - which is how we tell that something is broken, and needs fixed. You are using invalid input to the program, using two different wrong extensions to make LibreOffice try to open the file; and describe some behavior that should be either denial to open the document, or showing some garbage (both are OK). You haven't yet explained what result you actually see (I mean, is the "XLS" gets converted to the PDF with the proper 3D image of the data in the original PRT, and what shown on screen when "both the files are opening in Libre"). Up to this point, I assumed that your "open" means "I see the proper document", but now I think that you simply wanted to know why there's the difference between *error on loading and loading of garbage*.

If you are just curios, please do *not* abuse the bug tracker, and ask such questions (with *proper* explanation of the procedure, circumstances, results and your goal) at https://ask.libreoffice.org.

I'm inclined to close this INVALID.
Comment 12 Mike Kaganski 2022-04-20 13:05:53 UTC
Aha, I see now that this is https://ask.libreoffice.org/t/libre-is-throwing-error-if-xls-file-is-renamed-to-xlsx/76368/. Since it lacked all useful information there, it couldn't be answered properly.
Comment 13 Vikas 2022-04-20 14:16:29 UTC
I opened an issue here because I was not able to upload files properly to https://ask.libreoffice.org.

I didn't want to abuse the bug tracker. Hence filed it as a Bug here.