Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Greg Green XLSXWorkBookVFPX for extracting from Ex
Message
 
 
To
30/11/2018 12:27:17
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01663900
Message ID:
01663932
Views:
48
Hi Greg,
Thank you for your reply.

I replaced the "thisform.WorkBook" in your sample code with the value of lnWB (handle to the workbook).
Then I call GetSheetRowValues() to get the row values.
Question: do these values go into a cursor that I can read/browse? I tried the cursor named "xl_cells" (that you suggested) but it does not exist.
And even after the code gets a row value, do you have to manually populate it? Or is there a cursor that get filled?

TIA




>Hello--
>
>Glad you are trying to use the class -- hopefully it will work for you needs. The class reads an XLSX file and loads the rows/cells into a cursor xl_cells (and others as well) as the main cursor that contains the sheet data. This table is documented in the documentation at the end.
>
>The basic steps are as follows (assuming you have the file name and have an instance of the class named loExcel); the below example only returns the first row in the sheet, just iterate over all rows to get all cell values.
>
>
>lnWB = loExcel.OpenXlsxWorkbook(lcFileName, .F.)      && this opens the Excel file and reads into the internal cursors; lnWB is the handle to the new workbook
>IF lnWB > 0
>	loRow = loExcel.GetSheetRowValues(thisform.Workbook, 1, 1)    && See documentation -- this returns the cell values for first row with datatype
>	IF ISNULL(loRow)
>		&& failure
>	ELSE
>		FOR lnCol=1 TO loRow.Count
>			IF !ISNULL(loRow.Values[lnCol, 1]) .AND. !EMPTY(loRow.Values[lnCol, 1])
>				&& Got a cell value
>			ENDIF
>		ENDFOR
>	ENDIF
>ELSE
>  && Failure
>ENDIF
>
"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