Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VfpxWorkBookXlsx
Message
 
 
To
29/09/2020 21:25:49
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01676306
Message ID:
01676323
Views:
52
>>I am troubleshooting an issue with converting a cursor to an XLSX file using Greg Green's tool, VfpxWorkBookXlsx.
>>
>>When I convert a "good" cursor, using the method SaveTableToWorkbook(), I check the returned object values. The docs say the following:
>>
>>Return Value:
> >           Return object:
> >                       loReturn.Workbook Workbook Id; zero on failure
> >                       loReturn.Sheet Sheet Id; zero on failure
>>
>>
>>In my case, both the Workbook and Sheet properties return 0 (zero) but no error. And the resulting Excel file seems to be good. Why they the method returns 0 (zero)?
>
>Can you provide an example to reproduce this behavior? Looking at the code, it sets the return values just before the RETURN statement:
>
>
>loReturn.Sheet    = lnSh
>loReturn.Workbook = lnWB
>this.RestoreVFPSettings()
>RETURN loReturn
>
>
>The values for lnSh and lnWB if set to zero, the workbook is not created (there are IF statements to prevent this from occurring); these values have to be set to non-zero for the workbook to be created. BTW -- I have changed the code above and have a new version in Beta testing.

Here is a segment of the code:
loExcel = NEWOBJECT("VFPxWorkbookXLSX", "VFPxWorkbookXLSX.vcx")
loReturn = loExcel.SaveTabletoWorkbook(lcCursorName, cExcelFileName, .T., .T., tcWorkSheetName)
		
MESSAGEBOX( loReturn.Sheet, 48, "loReturn.Sheet")   && returns 0
MESSAGEBOX( loReturn.WorkBook, 48, "loReturn.WorkBook")  && returns 0
This troubleshooting started when a customer was getting an error (right after the call to the SaveTableToWorkbook() method:
*-- The error is a messagebox
*-- Title: 
"Compressed (zipped) Folders Error"
*-- Message:
"File not found or no read permission"
I look everywhere in the code of the class VFPxWorkbookXLSX but I can't find this message. I also looked in my VFP 9 application for this message but I can't find it either. The XLSX file created after the error (it is created nevertheless) cannot be opened. Excel reports that the file is corrupted.

Oddly enough if I split the same cursor (that generates the error above) into 4 cursors (the total is about 3000 records so I created 3 cursors of 1000 records and one with the left rows), I get no error. And the resulting XLSX file is readable without any problems.

Let me know if I need to try different approach in troubleshooting this problem.

Thank you!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform