Created attachment 142708 [details] Example file from Excel There is a VBA macro in the attached file which exports and saves the sheets to individual/new Workbooks. The main command which will “Save As” the sheets is: Application.ActiveWorkbook.SaveAs FILENAME, FILEFORMAT ; The FILEFORMAT tag was ignored or LibreOffice did not recognize the FILEFORMAT number (in case of *.xlsx →51). It is a problem when we use a macro in an *.xlsm/xls file and would like to export the sheets AS *.xlsx. The VBA Project is not removed properly from the new files and the file extension is wrong according to Microsoft Excel. (Zip file error). The exported sheets opened correctly with LibreOffice Calc, but the VBA Project was still there without any Objects. Steps to reproduce: 1. Open the attached spreadsheet (“Makro_Save_as_Sheets.xlsm”) with LibreOffice Calc 2. Run the macro and try to open the exported file with Microsoft Excel. This is the key command which does the export: xFile = FolderName & "\" & Application.ActiveWorkbook.Sheets(1).Name & datum & ".xlsx" Application.ActiveWorkbook.SaveAs xFile, FileFormat:=51 Actual results: If the source file (which included the macro) was an *.xlsm/xls file LibreOffice exports the VBA Project even if we set the export format to *.xlsx. When we try to open with Microsoft Excel, we get an error message. (BAD FORMAT) The exported sheets opened correctly with LibreOffice Calc, but the VBA Project was there without any Objects. Expected results: We should not get an error message and the “Application.ActiveWorkbook.SaveAs xFile, FileFormat:=51” command should work correctly even if the source file was a different type. (BAD FORMAT) Version: 6.2.0.0.alpha0+ Build ID: 1e9e01dff0a8d65bb10d5a886cca7899b43979da CPU threads: 4; OS: Windows 6.1; UI render: default; TinderBox: Win-x86@42, Branch:master, Time: 2018-05-27_05:50:28 Locale: hu-HU (hu_HU); Calc: group threaded
Created attachment 142709 [details] Example file saved with the macro from Calc
Created attachment 142710 [details] Error messave when trying to open the file in Excel ~ "Excel can't open the file, because it has an invalid extension or format. Check the file integrity and that the content matches the extension"
https://opengrok.libreoffice.org/xref/core/oovbaapi/ooo/vba/excel/XlFileFormat.idl?r=3656a57e#20 https://opengrok.libreoffice.org/xref/core/sc/source/ui/vba/vbaworkbook.cxx?r=8ddca064#367 https://opengrok.libreoffice.org/xref/core/sc/source/ui/vba/vbaworkbook.cxx#setFilterPropsFromFormat
(In reply to himajin100000 from comment #3) > https://opengrok.libreoffice.org/xref/core/oovbaapi/ooo/vba/excel/ > XlFileFormat.idl?r=3656a57e#20 Following https://msdn.microsoft.com/fr-fr/vba/excel-vba/articles/xlfileformat-enumeration-excel, it seems that adding xlOpenXMLWorkbook (which has 51 for value) would help here.
+ use the new constants at different locations quoted by Himajin (and also indicated by https://opengrok.libreoffice.org/search?project=core&q=xlExcel9795&defs=&refs=&path=&hist=&type=)
Thanks for the code pointers. Seems like @Balazs, you might be interested in this one :).
Thanks for the code pointers. Seems like an easyhack. @Balazs, you might be interested in this one :).
two more source code pointers. https://opengrok.libreoffice.org/xref/core/sc/source/ui/docshell/docsh.cxx?r=b79fa59d#149 https://opengrok.libreoffice.org/xref/core/filter/source/config/fragments/filters/
Dear Gabor Kelemen, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Dear Gabor Kelemen, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
This is still a problem in Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 14a36ad49518bcb5b606b0f1640e3ca56b636e89 CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: default; VCL: win Locale: en-US (hu_HU); UI: en-US Calc: threaded
A bit more investigation in this area revealed that Calc changed the file format: renaming the generated files to xls makes Excel happily open them.