Issue 19664 - Custom functions are recognized as names of cell ranges when opening Excel documents
Summary: Custom functions are recognized as names of cell ranges when opening Excel do...
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1 RC2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
URL:
Keywords:
: 21045 (view as issue list)
Depends on:
Blocks:
 
Reported: 2003-09-16 19:49 UTC by akrioukov
Modified: 2013-08-07 15:15 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
MS Excel document containing some custom functions (20.50 KB, application/octet-stream)
2003-09-18 12:50 UTC, akrioukov
no flags Details
Bugdoc with broken named range (13.50 KB, application/vnd.ms-excel)
2004-07-12 10:31 UTC, oc
no flags Details
patch to fix this and issue 25883 (2.36 KB, patch)
2004-07-15 19:15 UTC, john.marmion
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description akrioukov 2003-09-16 19:49:10 UTC
For a long time I used an Excel application where cell values were calculated with some 
custom functions written in Visual Basic. Unfortunately, all these functions have names 
consisting from 2 letters, e.g. CY(), DY(), RY() etc. However, in MS Excel these names were 
never confused with column markers, because they are always followed by their arguments 
in parentheses. So my cell formulas could look as follows: 
 
=5*ROUND(1000*(NY(D237))*C87*1,25*(CY(D222));-1) 
 
Now, when I open such a document in OOo, my function names are recognized as column 
markers, even if the functions itself are available to OOo (there is no problem to convert 
them, since they contain only arithmetical calculations and no references to application 
objects). Moreover, the parentheses surrounding their arguments are automatically 
removed, and a semicolon is inserted instead. So the function above looks in OOo as 
follows: 
 
=5*ROUND(1000*(NY;D237)*C87*1,25*(CY;D222);-1) 
 
Even if I restore the parentheses manually, my formulas still don't work, and I always got a 
511 error instead of correct calculations. The only way to fix the problem is changing names 
for all my functions, but I have a lot of spreadsheet documents which should be converted 
and a lot of cells using these functions in each of them.  
 
And, since my naming conventions never caused problems in MS Excel, I think it should be 
possible to make OOo Calc correctly handle such functions for better compatibility with MS 
Office.
Comment 1 frank 2003-09-17 10:37:36 UTC
Hi,

I've checked it using OOo1.1rc4  on Linux and Windows and can not
reproduce the problem you are facing.

Please use the latest build which is currently OOo1.1RC4 to check.

For know closed worksforme

Frank
Comment 2 frank 2003-09-17 10:37:56 UTC
closed worksforme
Comment 3 akrioukov 2003-09-17 17:48:35 UTC
Now I see I've incorrectly described the problem, so nothing strange if you 
couldn't reproduce it. 
 
The problem looks now as follows. The names of my functions are *not* 
confused with column markers. Instead, they are recognized as names of cell 
areas. After opening an Excel document, I can go to Insert->Names->Define and 
see all these names (DY, CY, RY...) in the dialog box. 
 
I am sure the initial Excel document didn't include any cell areas with such 
names. This means OOo export filters simply inserts them instead of function 
names it can't recognize. So I have to manually remove all  such autogenerated 
entries from the "Insert Name" dialog in order to be able to use my custom 
functions. However, this doesn't make my imported document more correct, 
because I still have to insert omitted parentheses around each function's 
arguments. 
 
Of course I understand that all custom functions are very probably "invalid" at 
the time the Excel document is imported, because our Visual Basic code is not 
available to OOo. However it is much easier to rewrite a macro code for OOo 
*once* than to restore parentheses in hundreds of cells. So I think the import 
filter for Excel files should be corrected at this point. 
 
Comment 4 frank 2003-09-18 09:01:59 UTC
Hi,

could you attach a document showing this behaviour ? 

It would make it easier to reproduce. If the data is confidential, you
can change them to values producing non correct stuff.

Thanks for your help.

Frank
Comment 5 akrioukov 2003-09-18 12:50:31 UTC
Created attachment 9451 [details]
MS Excel document containing some custom functions
Comment 6 akrioukov 2003-09-18 12:57:00 UTC
No confidential information, just a testcase document. To reproduce the 
problem: 
 
-- open custfuncs.xls in MS Excel to ensure everything is correct. The cells B1 
and C1 should contain the following formulas: 
 
=AA(A1) 
=AAA(A1) 
 
The functions itself are defined in a VBA module inluded into the same document. 
Of course they are very simple and should work both in MS Excel and OOo 
without any modifications. 
 
-- Now open the file in OOo and take a look at the same cells. They contain the 
following pseudo-formulas: 
 
=(AA;A1) 
=(AAA;A1) 
 
-- Go to Insert->Names->Insert. The "Insert name" list box contains two 
entries: AA and AAA. 
 
 
 
Comment 7 frank 2003-09-18 14:56:39 UTC
Hi,

as you said removing rems once and add some dim's is easier The
parantheses are set by the excel import filter and this one will be
improved.

As this is not an easy task, don't expect it before OOo2.0.

Also this is more an enhancement then a defect. So I changed the Issue
type and re-assign it to the appropriate developer.

Thanks for your help.

Frank
Comment 8 frank 2003-09-18 14:57:29 UTC
Hi Daniel,

as discussed this one is yours.

Frank
Comment 9 daniel.rentz 2003-09-18 16:58:35 UTC
accepted
Comment 10 daniel.rentz 2003-10-14 11:21:53 UTC
*** Issue 21045 has been marked as a duplicate of this issue. ***
Comment 11 daniel.rentz 2003-12-11 10:08:58 UTC
fixed
Comment 12 daniel.rentz 2003-12-11 10:10:57 UTC
wrong issue -> reopened
Comment 13 daniel.rentz 2003-12-11 10:11:48 UTC
started again
Comment 14 oc 2004-05-28 11:13:59 UTC
OC: Due to high workload this issue is retargeted to office.later
Comment 15 daniel.rentz 2004-06-02 11:14:18 UTC
John will take care about this
Comment 16 john.marmion 2004-06-02 17:24:51 UTC
mark started
Comment 17 john.marmion 2004-06-09 14:03:41 UTC
patch for issue 26402 checked in today for cws/dr19 will fix this issue.
Comment 18 john.marmion 2004-07-06 19:23:45 UTC
reopen to reassign
Comment 19 john.marmion 2004-07-06 19:24:18 UTC
assign to qa
Comment 20 john.marmion 2004-07-06 19:24:55 UTC
reset to fixed
Comment 21 oc 2004-07-12 10:27:13 UTC
reopened because fixed but failed
Comment 22 oc 2004-07-12 10:29:48 UTC
Hi John, this fix has broken the named ranges in functions. If I import a
document with a named range in a function I'll get ERR:508. I've attached a
simple bugdoc which show this fault.
Comment 23 oc 2004-07-12 10:31:32 UTC
Created attachment 16406 [details]
Bugdoc with broken named range
Comment 24 john.marmion 2004-07-12 10:45:42 UTC
accepted
Comment 25 oc 2004-07-12 13:27:14 UTC
adjusting target milestone to OOo2.0
Comment 26 john.marmion 2004-07-15 19:15:59 UTC
Created attachment 16496 [details]
patch to fix this and issue 25883
Comment 27 john.marmion 2004-07-20 09:45:27 UTC
checked in  patch today to cws/dr19.
Comment 28 oc 2004-07-23 15:54:35 UTC
verified in internal build cws_dr19
Comment 29 daniel.rentz 2005-03-21 17:51:34 UTC
reopened
Comment 30 daniel.rentz 2005-03-21 17:51:58 UTC
back to QA
Comment 31 daniel.rentz 2005-03-21 17:52:21 UTC
fixed
Comment 32 oc 2005-04-06 09:36:58 UTC
reset verification status
Comment 33 oc 2005-04-06 09:37:29 UTC
closewd because fix available in current master