[Stackoverflow] [Progress OpenEdge ABL] (OpenEdge Progress) Problem checking number of decimal places in excel via COM-Object

Status
Not open for further replies.
F

Frank Kai Hei Chan

Guest
fellows,

I am writing a program with OpenEdge Progress 11.7, which is to validate an excel file provided by internal users. One of the things that I need to validate is the number of digits that the decimal numbers have on the spreadsheet. On the excel, the decimal numbers are displayed with 4 decimal places. However, if I invoke the LENGTH function in Progress to Read the decimal numbers, it returns me the integer that show the decimal numbers have more than 4 decimal places(please refer to the below screenshots). Is there any workaround that I might adopt? Please accept my gratitude for any advice.

Thank you.

Pseudo Code:

Code:
DEFINE VARIABLE chExcel AS COM-HANDLE.
DEFINE VARIABLE chWB AS COM-HANDLE.
DEFINE VARIABLE chWS AS COM-HANDLE.
DEFINE VARIABLE cInFinFile AS CHARACTER NO-UNDO.

cInFinFile = "N:\test.xlsx".

/* create excel instance */
CREATE "Excel.Application" chExcel.
ASSIGN
    chExcel:Visible = TRUE
    chExcel:screenupdating = TRUE
    chExcel:displayAlerts = FALSE
    chWB = chExcel:Workbooks:OPEN(cInFinFile).
    
MESSAGE chExcel:Range("C5"):VALUE SKIP LENGTH(chExcel:Range("C5"):VALUE) VIEW-AS ALERT-BOX.
    
chWB:CLOSE.
RELEASE OBJECT chWB NO-ERROR.
chExcel:QUIT().
RELEASE OBJECT chExcel NO-ERROR.

Value on Excel:

Value get in Progress:

I try to invoke the Excel com-handle RUN to call the "LEN" function instead to check the length but the return does not look good

Continue reading...
 
Status
Not open for further replies.
Top