Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import tables from OpenOffice / LibreOffice documents (Calc's ods, Impress' odp or Writer's Odt)

Status
Not open for further replies.

vgulielmus

Programmer
Jan 27, 2014
515
0
0
RO
Description
A single unfied function to import data from tables contained in OpenOffice / LibreOffice documents (Calc's ods, Impress' odp and Writer's odt)

The signature is the same used for ImportFromOoCalc
The data are extracted directly from the document.
No automation, no ODBC are used.

Features
- return the name of the generated DBF / cursor; the same name with de ods,odp,odt / SYS(2015)
- analyze the first (imported) row of the ods,odp,odt table and get the number of columns and data types from this row
- creates a DBF / cursor (according to the sixth parameter)
- and populate this DBF with data from the ods,odp,odt
- when parameter lnHeader between 1 and lnStartRows the field names are taken from that row of the table, otherwise the fields are named mField1,mField2 and so on
- a field is considered of type date, if CTOD() is not empty; SET DATE must be set properly, to import the date and datetime values
- the decimal separator is taken from SET POINT TO
- a field is considered of type number, if contains only digits, and no more than a decimal separator, and no more than one + or - (either one +, either one -) in the leftmost position
- the size and precision of the numeric field is calculated with MAX(LEN(ALLTRIM(cell value))), respectively with MAX(LEN(ALLTRIM(cell value))-AT(decimal separator,ALLTRIM(cell value))
- a field is considered logical if the cell contains "true" or "false"
- the length of character fields is MAX(LEN(cell value))
- if MAX(LEN(cell value)) > 254 or contains at least one CHR(13), the field is MEMO

Download link
ImportFromOoffice 1.0

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top