New: Read/Edit/Save XLSX files without Excel/ADO

New: Read/Edit/Save XLSX files without Excel/ADO

Postby nageswaragunupudi » Tue Dec 24, 2024 4:32 am

Next version of FWH under release enable reading, modifying and also saving the changes (to another xlsx file) without Excel or ACE OLEDB installed on the PC.

Simple Usage:
Code: Select all  Expand view  RUN
FW_ShowXLSX( cFileXlsx, [cSheet] ) // --> oXlsx object


Examples:
Code: Select all  Expand view  RUN
FW_ShowXLSX( "customer.xlsx" )

Image

Code: Select all  Expand view  RUN
FW_ShowXLSX( "wwonders.xlsx" )

Image

The browses are fully editable and the modified data can be saved to another xlsx file by clicking the Excel button.

DATAS AND METHODS
Code: Select all  Expand view  RUN
DATAS:
DATA cXlsx          // xlsx filename
DATA nRows,nCols  // size
DATA aHead  // header array
DATA aStruct
DATA aData  
ACCESS oData  // aData in the form of TArrayData

METHODS:
METHOD ReadData()        
METHOD ShowData()        
METHOD Range( cRange )    
METHOD Cells( nRow, [anCol] )
METHOD SaveAs( cSave )    
METHOD Close()/End()            
 


Notes:
1. Reads only values and data types of the cells but does not read other formatting information like font character specs or other formatting like pictures, border styles, etc.
2. Reads only scalar data and embedded images from the cells but does not read Charts and other objects embedded in the sheet.
3. Saving will save only the current tab/sheet and does not save formatting information contained in the original xlsx file.
So, please never save by over-writing the original source file.

Size Limitations:
With 32-bit applications we may face limitations with very huge size of the xlsx file. We are testing but still not sure of the limitations.

We tested with xlsx files of the following sizes:
1) 9,000,000 rows, 12 cols and file size : 87,183,538 bytes
2) 32,000 rows, 502 columns and file size: 79,998,254 bytes
Every thing worked perfectly without any problems.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Read/Edit/Save XLSX files without Excel/ADO

Postby nageswaragunupudi » Tue Dec 24, 2024 5:11 am

Recommendations while using very large xlsx files:
In such cases, most of the times, we won't be interested in reading and browsing the entire table, but only extracting limited information required.
We may adopt this approach:
Code: Select all  Expand view  RUN
oXl := FW_OpenXlsx( cFileXlsx, [cSheet] )
? oXl:nRows, oXl:nCols
aData := oXl:Range( "E21100:H:21110" )
// use aData as required
aRowValues := oXl:Cells( nRow )
// array containing values of all columns in the row
aVals := oXl:Cells( nRow, { nCol1, nCol2, ... } )
// array of values in columns specified
uValue := oXl:Cells( nRow, nCol )
// value of a single cell

oXl:End()
oXl := nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: New: Read/Edit/Save XLSX files without Excel/ADO

Postby Antonio Linares » Tue Dec 24, 2024 5:35 am

Great work from Mr. Rao as usual :-)

Thank you very much!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests