Created attachment 64804 [details] Excel test file with macro Excel Visual Basic Date/time formatting does not work, Excel macro code examples: Example macro: Sub Test_NumberFormat_DateTime() ' Preparing Test: Range("A3").FormulaR1C1 = "40969.6388888889" Range("B3").FormulaR1C1 = "40969.6388888889" Range("C3").FormulaR1C1 = "40969.6388888889" Range("D3").FormulaR1C1 = "40969.6388888889" Range("E3").FormulaR1C1 = "40969.6388888889" Range("F3").FormulaR1C1 = "40969.6388888889" Range("A3").Select ' Testing Excel VBA Code in Libre Office: Range("A3").NumberFormat = "hh:mm" Range("B3").NumberFormat = "mm/dd/yyyy hh:mm" Range("C3").NumberFormat = "mm/dd/yyyy hh:mm:ss" Range("D3").NumberFormat = "d/m/yy h:mm" Range("E3").NumberFormat = "d/ mmmm yyyy" Range("F3").NumberFormat = "d/ mmm yyyy" End Sub The same problem with the NumberFormat function on Windows systems with other regional settings. Example Windows "Regional and Language Options": "German (Germany)" with Formula/List Separator ';' and Decimal Symbol ',' Sub Test_NumberFormat_Number() Range("A3").NumberFormat = "0,00000000" Range("B3").NumberFormat = "0.00000000" Range("C3").NumberFormat = "#,##0.00000" End Sub
This bug occurs in LibreOffice version 3.5.6 and 3.6.1
Tor: do you reproduce this with a newer LO version (4.1.4 or 4.2.0.4)?
Yes, I reproduced this bug also in newer versions of LibreOffice for Windows! Tested with LibreOffice versions: 4.0.4.2, 4.1.4.2 and 4.2.0.4
This bug was reproduced also in LibreOffice Calc version 4.2.3.3 and 4.2.4.1 rc!
** Please read this message in its entirety before responding ** 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 on a currently supported version of LibreOffice (4.4.3 or later) https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System 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) 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: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2015-06-08
The problem still exists! This bug was also reproduced in LibreOffice 4.4.3.2!
This problem still exists and was also reproduced in LibreOffice versions 4.4.7.2, 5.0.4.2, 5.1.1.3 and 5.1.4.2 for Windows. (Test system: Windows 7 64-bit, Intel Core2Duo P8700 2.53 Ghz, 4 GB RAM, Java SE Runtime Environment build 1.6.0_24-b07)
Changing version back to the earliest affected version.
Bug also reproduced with the newest version of LibreOffice 5.4.2 for Windows.
Dear Tor24_1975314, 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 Tor24_1975314, 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://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
The problem still exists in LibreOffice 7.3.4.2 with Linux Mint 20.3 Cinnamon. Another variations on the Number format which don't exist are shown below. Sheets(1).Columns(1).NumberFormat = "@" Sheets(1).Columns(2).NumberFormat = "$#,##0.00;[Red]$#,##0.00" Sheets(1).Columns(3).NumberFormat = "$#,##0.00"" Cr"";[Red]$#,##0.00"" Dr""" Above code modified from Statement.xls attachment in bug 149325. Thank you
Created attachment 180703 [details] Excel_VBA_Test_Working.xls It seems that LibreOffice Calc Macros are case-sensitive. Change: d → D m → M y → Y h → H m → M s → S Does it work for you? Thank you (In reply to Tor24_1975314 from comment #0) Modified Excel test file with macro Modified Excel Visual Basic Date/time formatting to make it work, Excel macro code examples: Example macro: Sub Test_NumberFormat_DateTime() ' Preparing Test: Range("A3").FormulaR1C1 = "40969.6388888889" Range("B3").FormulaR1C1 = "40969.6388888889" Range("C3").FormulaR1C1 = "40969.6388888889" Range("D3").FormulaR1C1 = "40969.6388888889" Range("E3").FormulaR1C1 = "40969.6388888889" Range("F3").FormulaR1C1 = "40969.6388888889" Range("A3").Select ' Testing Excel VBA Code in Libre Office: Range("A3").NumberFormat = "HH:MM" Range("B3").NumberFormat = "MM/DD/YYYY HH:MM" Range("C3").NumberFormat = "MM/DD/YYYY HH:MM:SS" Range("D3").NumberFormat = "D/M/YY H:MM" Range("E3").NumberFormat = "D/ MMMM YYYY" Range("F3").NumberFormat = "D/ MMM YYYY" End Sub
It seems that color (e.g. RED) is case-sensitive and the currency symbol needs quotes to make it a string (e.g. "$") (In reply to Óvári from comment #12) Microsoft Excel → LibreOffice Calc dd mmm yyyy → DD MMM YYYY $#,##0.00;[Red]$#,##0.00 → $#,##0.00;[RED]"$"#,##0.00 $#,##0.00" Cr";[Red]$#,##0.00" Dr" → $#,##0.00" Cr";[RED]"$"#,##0.00" Dr"
It's only the dreaded API that the VBA layer uses that makes it case-sensitive. The effect of making "$" a quoted string is none, or just that the format code doesn't exist yet and can be added without duplicate (where case-insensitive duplicates effectively prevent the assignment to NumberFormat from working). The actual difference in the example is [RED] vs [Red]
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8661d5579bd19a9e294ddff64bbe817b537dbd46 Resolves: tdf#149325 tdf#52602 SvNumberFormatsObj::queryKey try also uppercase It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/c98a60742a25eb4d4526f109f9af9de391da0643 Resolves: tdf#149325 tdf#52602 SvNumberFormatsObj::queryKey try also uppercase It will be available in 7.4.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/fc5357935cc160fd19b61db7cbf7f098962d42a3 tdf#52602: sc_vba_macro_test: Add unittest It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a4fa06be4f8cd4d2584a6f3e4c5bd02786e591ad Related: tdf#149325 tdf#52602 SvNumberFormatsObj::addNew accept differing It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/e5f403b7e6a5d2d99a01a2111224b5277beba0d5 Related: tdf#149325 tdf#52602 SvNumberFormatsObj::addNew accept differing It will be available in 7.4.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified fixed with LibreOffice Version: 7.5.0.0.alpha0+ / LibreOffice Community Build ID: ca47989ad60b1414f92be22a1fbf4c1d1a92dd97 CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded with Linux Mint 20.3 Cinnamon Thank you