Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Greg Green XLSXWorkBookVFPX for extracting from Ex
Message
De
30/11/2018 12:27:17
 
 
À
30/11/2018 08:56:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
01663900
Message ID:
01663926
Vues:
79
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform