Page 1 of 1

E4007: Missing right paranthesis

Posted: Thu Oct 24, 2013 8:05 am
by alexpirate
Hi,

if you try

XLS[0].AsFormula[3 * J + 2, I] := 'ROUNDUP(' + ColToText(3 * J + 1) + IntToStr(I + 1) + '/8;0)';

in xvExcel2007 mode

if you try the same in xvExcel97 mode, no problems.


another case
if you try in xvExcel97 mode this
XLS[0].AsFormula[1, I] := 'SUM(' + ColToText(1) + IntToStr(IFirst + 1) + ':' + ColToText(1) + IntToStr(I - 1);

it's ok with the missed +')';
but if you try it in xvExcel2007 mode then the error is raised.

when you correct the formula it works ok with the two modes xvExcel2007 and xvExcel97
XLS[0].AsFormula[1, I] := 'SUM(' + ColToText(1) + IntToStr(IFirst + 1) + ':' + ColToText(1) + IntToStr(I - 1)+')';

i'm seeing that in xvExcel97 mode, many errors which I made like a programmer, they not raises errors instead when you work in xvExcel2007.

can you say how nay sheets i can add in xvExcel97 mode, because I have seen that i' receiving error when try to add to many sheets in this mode and I don't have problems with the same count in xvExcel2007?

Re: E4007: Missing right paranthesis

Posted: Thu Oct 24, 2013 9:10 am
by larsa
Hello

Please provide samples that can be compiled.

Re: E4007: Missing right paranthesis

Posted: Thu Oct 24, 2013 1:30 pm
by alexpirate
ok i will make an example, but if i remeber corectly the problem was caused by this division '/8' - for the round problem in xvExcel2007 mode

Re: E4007: Missing right paranthesis

Posted: Sun Oct 27, 2013 2:38 am
by alexpirate
Hi,

this is the demo http://dox.bg/files/dw?a=5f81fd1239

the problem with the roundup function is from the delimiter character.
in xvExcel97 it is ;
in xvExcel2007 with ; will rise "E4007: Missing right paranthesis". if you use , for delimiter then no errors in the xvExcel2007 but in the xvExcel97 it rises Error in formula ROUND(B10/8,0) Illegal number


my configuration is:
Win 8 Pro 64 bit
Office 2013 64 bit
Delphi XE4 Update 1
the application target platforms is Win32

while creating this demo I've encountered another two bugs all of them caused by XLS[0].Columns.SetColWidth.
1. when You set the width on some column, when opened in excel the width of this columns is broken
2. when You try to set the width two times on same column this rise access violation

Re: E4007: Missing right paranthesis

Posted: Mon Oct 28, 2013 5:38 pm
by larsa
Hello

The problem wit the ROUNDUP (and possibly other) functions is is fixed in update 5.20.06

Regarding the column witdths; The first issue was caused by that you had set the column width to a versy small value and hence it disappeared. Normal col width is 2500. I could not reproduce the second issue.

Re: E4007: Missing right paranthesis

Posted: Thu Nov 14, 2013 12:53 am
by alexpirate
Hi,

I have checked version 5.20.06a and I continue to have access violation , when I try to set the width two times on same column.

XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);
XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);


my configuration is:
Win 8 Pro 64 bit
Office 2013 64 bit
Delphi XE4 Update 1
the application target platforms is Win32

Re: E4007: Missing right paranthesis

Posted: Sun Nov 17, 2013 11:42 am
by alexpirate
alexpirate wrote:Hi,

I have checked version 5.20.06a and I continue to have access violation , when I try to set the width two times on same column.

XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);
XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);

my configuration is:
Win 8 Pro 64 bit
Office 2013 64 bit
Delphi XE4 Update 1
the application target platforms is Win32
hi again,

I forgot to mention that this error rises when you try to write the file, not when you are setting the column width.

XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);
XLS[0].Columns.SetColWidth(0, 0, 2500);
XLS[0].Columns.SetColWidth(2, 2, 2500);
XLS.Write;

Re: E4007: Missing right paranthesis

Posted: Tue Nov 19, 2013 4:21 pm
by larsa
Hello

This is fixed in update 5.20.08

Re: E4007: Missing right paranthesis

Posted: Mon Feb 22, 2016 2:37 pm
by mario
Hi, I have the same problem on this row:
formula := 'If(C1<35;C2;C3)';
XLS[0].AsFormula[i, j] := formula;

Version: 5.20.70a
Mario

Re: E4007: Missing right paranthesis

Posted: Tue Feb 23, 2016 8:11 am
by larsa
Hello

You are using the wrong character for argument separator. It shall be the same as the ListSeparator value. Example:

Code: Select all

formula := 'If(C1<35' + FormatSettings.ListSeparator + 'C2' + FormatSettings.ListSeparator + 'C3)';

Re: E4007: Missing right paranthesis

Posted: Tue Feb 23, 2016 10:06 am
by mario
Hello, thanks for your answer, but I still have the problem. Nothing is changed.

Re: E4007: Missing right paranthesis

Posted: Tue Feb 23, 2016 11:42 am
by larsa
Hello

What is the values of FormatSettings.ListSeparator and FormatSettings.DecimalSeparator ?

Re: E4007: Missing right paranthesis

Posted: Wed Feb 24, 2016 1:43 pm
by mario
Hello.

FormatSettings.ListSeparator = ';'
FormatSettings.DecimalSeparator = ','

Is there anything wrong?

If I copy my formula to paste in a excel 2007 cell, it works just fine.

Thanks

Re: E4007: Missing right paranthesis

Posted: Thu Feb 25, 2016 2:15 pm
by larsa
Hello

Sorry, I can't find anything wrong. Please try a simpler formula, like 'SUM(A1)'. If it works, make it more complex.

Re: E4007: Missing right paranthesis

Posted: Fri Mar 04, 2016 11:38 am
by mario
Hello,
finally the problem is solved.

I had to use DecimalSeparator and not the ListSeparator.

Thanks