E4007: Missing right paranthesis

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
alexpirate
Posts: 13
Joined: Sat Aug 20, 2011 9:46 am

E4007: Missing right paranthesis

Post 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?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post by larsa »

Hello

Please provide samples that can be compiled.
Lars Arvidsson, Axolot Data
alexpirate
Posts: 13
Joined: Sat Aug 20, 2011 9:46 am

Re: E4007: Missing right paranthesis

Post 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
alexpirate
Posts: 13
Joined: Sat Aug 20, 2011 9:46 am

Re: E4007: Missing right paranthesis

Post 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
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post 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.
Lars Arvidsson, Axolot Data
alexpirate
Posts: 13
Joined: Sat Aug 20, 2011 9:46 am

Re: E4007: Missing right paranthesis

Post 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
alexpirate
Posts: 13
Joined: Sat Aug 20, 2011 9:46 am

Re: E4007: Missing right paranthesis

Post 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;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post by larsa »

Hello

This is fixed in update 5.20.08
Lars Arvidsson, Axolot Data
mario
Posts: 8
Joined: Mon Feb 25, 2013 10:39 am

Re: E4007: Missing right paranthesis

Post 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
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post 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)';
Lars Arvidsson, Axolot Data
mario
Posts: 8
Joined: Mon Feb 25, 2013 10:39 am

Re: E4007: Missing right paranthesis

Post by mario »

Hello, thanks for your answer, but I still have the problem. Nothing is changed.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post by larsa »

Hello

What is the values of FormatSettings.ListSeparator and FormatSettings.DecimalSeparator ?
Lars Arvidsson, Axolot Data
mario
Posts: 8
Joined: Mon Feb 25, 2013 10:39 am

Re: E4007: Missing right paranthesis

Post 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
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: E4007: Missing right paranthesis

Post 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.
Lars Arvidsson, Axolot Data
mario
Posts: 8
Joined: Mon Feb 25, 2013 10:39 am

Re: E4007: Missing right paranthesis

Post by mario »

Hello,
finally the problem is solved.

I had to use DecimalSeparator and not the ListSeparator.

Thanks
Post Reply