Bug 109132 - FILESAVE: ODS: VBA Macro name in Cell are converted to lowercase and macro is unknown
Summary: FILESAVE: ODS: VBA Macro name in Cell are converted to lowercase and macro is...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.2.0.0.alpha1
Hardware: All All
: medium normal
Assignee: Markus Mohrhard
URL:
Whiteboard: target:6.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2017-07-15 07:33 UTC by schlebe
Modified: 2018-07-27 07:21 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Original MS Excel file with macros (21.09 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-07-15 07:33 UTC, schlebe
Details
Simplified XLSM document (7.24 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2018-07-22 18:50 UTC, Markus Mohrhard
Details
Simplified ODS document (12.97 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-07-22 18:51 UTC, Markus Mohrhard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description schlebe 2017-07-15 07:33:21 UTC
Created attachment 134646 [details]
Original MS Excel file with macros

There are in fact 2 issues but very linked.

I have an Excel file (xlsm) that I open with Libre Office 4.3.7.2.
The file is opened correctly and the simple macro in it work correctly.
I save my work in ODS format because LibreOffice 4.3.7.2. can not save it in XLSM format.

I have try later with version 5.2.7.2. and I have no problem to save my work with macro in XSLM format.

The problem happens only when converting XLSM from ODS.
I continue to describe my problem ...

After saving my work in an ODS file, I reopen it and all the cells that contains simple CUSTOM macro display a warning message daying that the name of macro not exists !!!

In fact, in Original Excel the name is a mix of upper case and lower case and is equal to "NrAlbums".
When loaded in LibreOffice the name is converted in "NRALBUMS" and the macro continue to work correclty.
After saving the workbook in ODS file and open it again the name in cell's formula is converted "nralbums" where all characters are converter to lowercase. At this moment the macro is not more recognized.

This is the problem.

The first problem is that the orginal name in CELL is converted in UPPERCASE so that original Microsoft macro name is not kept. The second problem is that when LibreOffice load for a first time the new ODS file, the name is converted from uppercase to lowercase.

The name in macro is always unchanged = "NrAblbums"

I hope that this can help you to improve LibreOffice!

This error is same that Bug ID 74656 but this bug is from 2015 and seems not to be resolved.

I have explained why this error occurs and I hope that for this time it will be possible to reproduce it on your development environment.

I have attached the original Excel XLSM file to you have the possiblity to test what I have described.

Best regards
Comment 1 Xisco Faulí 2017-07-15 14:20:45 UTC
It seems ok in

Version: 5.1.0.0.alpha1+
Build ID: 7289a140fc68dc898ba2b2357cc960968195f236
Threads 4; Ver: 4.8; Render: default; 

but not in

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8)
Comment 2 Julien Nabet 2017-07-24 17:10:30 UTC
I use pc Debian testing x86-64.
Wih master sources updated today, i made some tests.
1) xlsm is proposed and I could save a clone of the file in xlsm
remark: with Debian package LO 5.3.4, xlsm format is proposed.

2) I could reproduce the fact that when loading xlsm, I've got "NRALBUMS" and when converting in ods and open again, it's "nralbums".

other remark: I suppose the xlsm clone must contain "NRALBUMS".
Comment 3 Aron Budea 2018-01-08 05:15:37 UTC
Bibisected to the comment referenced below, using repo bibisect-linux-64-5.2. Adding Cc: to Markus Mohrhard.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=e8322dffb4dfc7015ee0842f133b79080eb2b0d8
author		Markus Mohrhard <markus.mohrhard@googlemail.com>	2016-04-09 09:36:45 +0200
committer	Markus Mohrhard <markus.mohrhard@googlemail.com>	2016-04-09 08:52:30 +0000

import all formatting properties for column style, tdf#96549
Comment 4 Markus Mohrhard 2018-07-22 12:32:05 UTC
Actually this seems to be only partly related to the VBA code itself:

1.) In master and most likely all builds since the VBA export feature, exporting to XLSM works and reimport keeps the formulas.

2.) In master exporting to ODS and reimporting keeps the module and the formula is available but it seems that the formula is compiled before the module has been imported. Using the formula after the import works fine. Basically, this boils down to an import order issue.

The bibisect result must be completely wrong. This commit is in a completely different area.
Comment 5 Markus Mohrhard 2018-07-22 18:50:23 UTC
I'll attach simplified test documents.
Comment 6 Markus Mohrhard 2018-07-22 18:50:52 UTC
Created attachment 143691 [details]
Simplified XLSM document
Comment 7 Markus Mohrhard 2018-07-22 18:51:17 UTC
Created attachment 143692 [details]
Simplified ODS document
Comment 8 Commit Notification 2018-07-27 06:01:33 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=76bf3939b0583212a56c317c85aea110f8ac6fee

related tdf#109132, ugly hack to ensure the VBA mode is setup during import

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2018-07-27 06:02:53 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9ea6c0e6777c5b367ec507f10858c9c4be5960ed

tdf#109132, load VBA library by default during ODF import

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2018-07-27 07:19:52 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b45926a3a1dd89ffec3ed766ab5647604c23eec0

add test for tdf#109132

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.