(Visual FoxPro) XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets. Note: This example requires Chilkat v11.3.0 or greater.
LOCAL lnSuccess
LOCAL loZip
LOCAL loCsv
LOCAL loSheetNames
LOCAL i
lnSuccess = 0
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* .xlsx files are Zip archives
loZip = CreateObject('Chilkat.Zip')
lnSuccess = loZip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
IF (lnSuccess = 0) THEN
? loZip.LastErrorText
RELEASE loZip
CANCEL
ENDIF
loCsv = CreateObject('Chilkat.Csv')
loSheetNames = CreateObject('Chilkat.StringTable')
lnSuccess = loCsv.XlsxGetSheets(loZip,loSheetNames)
IF (lnSuccess = 0) THEN
? loCsv.LastErrorText
RELEASE loZip
RELEASE loCsv
RELEASE loSheetNames
CANCEL
ENDIF
i = 0
DO WHILE i < loSheetNames.Count
? loSheetNames.StringAt(i)
i = i + 1
ENDDO
RELEASE loZip
RELEASE loCsv
RELEASE loSheetNames
|