Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading xlsx files in VFP
Message
 
 
To
26/01/2017 13:14:06
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01647030
Message ID:
01648169
Views:
46
>I found the issue when calling the Demo() method a second time. The first step is to create the workbook reference:
>
>
>lnWb = this.CreateWorkbook("ExcelTest.xlsx")
>
>
>This returns a 'handle' to the workbook object (1 based index) that is created. If it fails or if the same workbook already exists, then 0 is returned to denote a failure. So, executing Demo() a second time this method returns 0 (no workbook created). I did not include any checking for success in the demo. I have now added the following:
>
>
>lnWb = this.CreateWorkbook("ExcelTest.xlsx")
>IF lnWb = 0
>	RETURN False
>ENDIF
>
Hi Greg,

I got another question from Mark which hopefully you can help us with:

---------------------------------------------------------------------------------------------------
If you recall a little while ago you helped me determine the settings that were causing an error in the XLSX routine. It has been working fine until the other day when I encountered a problem.

I am trying to use the XLSX routine to process an xlsx spreadsheet created by a third party program that has only one sheet.

In this routine
FOR lnRow=1 TO goExcel.GetLastRowNumber(lnWb, loSheets.List[lnSh, 1])

I get an error message Operator / Operand type mismatch in this routine (statement causing error is hightlighted).
LPARAMETERS tnWB, tnSheet
LOCAL lnLastRow
IF PCOUNT() < 2
    RETURN .NULL.
ENDIF
lnLastRow = 0
SELECT MAX(tmp.cellrow) AS maxrow FROM xl_cells AS tmp ;
    WHERE workbook = tnWB ;
        AND tmp.sheet = tnSheet ;
        AND tmp.celldeleted = False ;
    INTO CURSOR t_temp
When I run the same XLSX file using the standalone program it works fine. I know that it must be some setting that is causing the problem. Can you please post the question to Greg.

I don't want to change all the settings just the one that is causing the problem so then I can reset it after the routine is finished.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform