Faceți căutări pe acest blog

Se încarcă...

duminică, 25 septembrie 2016

ImportFromOoWrText 1.0

A simple function that extracts the text contained in a Writer odt document, and creates a txt file with tha same name.

Download link
ImportFromOoWrText 1.0

ImportFromOoffice 1.o

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 / SYS(2015)
- analyze the first (imported) row of the ods 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
- 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
Import From Openoffice 1.0

luni, 19 septembrie 2016

CopyToXlsx6 1.0

A downgraded version of CopyToXlsx, changed to run under VFP 6.
The new function was renamed CopyToXlsx6

Download link
CopyToXlsx6 1.0

vineri, 16 septembrie 2016

Export DBF to OpenOffice / LibreOffice Writer

CopyToOdt 3.0 (function)
- Improved export of double and currency data type
- Other minor improvements

ExportToOdt 2.0 (class)
Bugs
- apply style when only backcolor was changes
- take into account cHeader property

Improvements
- Improved export of double and currency data type
- Other minor improvements

Download link
CopyToOdt 3.0
ExportToOdt 2.0

Export DBF to OpenOffice / LibreOffice Calc

Both a class and a function designed to export data contained in a table or a cursor (or the content of a grid) to an ods document (a OpenOffice / LibreOffice Calc spreadsheet).
 Neither the class, nor the function requires some additional software to be installed.
That means they don't use automation or ODBC / OleDB.
No need for OpenOffice, LibreOffcie or MsOffice.
Just run the code to create the desired document.

The function copyToOds 2.0
The signature of the function is the same to the signature of CopyToOdt
Bug solved
- integer, numeric, float and double data type now are exported
Improvements
- a few minor improvements

The class ExportToOds 1.0
The properties are the same to ExportToOdt class
Export the data displayed in a grid, or the data contained by a table / cursor

Properties
a) To export the data displayed in a grid (only the visible columns)
    Drop an instance of the exportods class to your form and set :
    - grid=grid reference
    - label (optional)=the default file name; a reference to an object with the "caption" property; by default DATETIME()

b) To export the data contained in a table / cursor
    Drop an instance of the exportods class to your form and set :
    - grid=table / cursor name
    - label (optional)=the default file name; a reference an object with the "caption" property; by default DATETIME()
    - cFields (optional)= list of fields to be displayed, separated by commas; by default all the fields are exported
    - cHeaders (optional)= list of field headers to be displayed, separated by commas; by default the field names

c) Formatting properties (right click)    headbackcolor=back color for column headers (if >=0)
    headfontbold= .T./.F.
    headfontitalic= .T./.F.
    headfontname=if not empty and installed
    headfontsize=if>0
    headforecolor=font color for column headers (if >=0)

    rowbackcolor=back color for rows (if >=0)
    rowfontbold= .T./.F.
    rowfontitalic= .T./.F.
    rowfontname=if not empty and installed
    rowfontsize=if>0
    rowforecolor=font color for rows (if >=0)

d) Miscelaneous
    a) SheetName
        character (default sheet1)
        public
        desired sheetname
    b) sheetFirstCol
        character (default A)
        public
        start column
    c) sheetFirstRow
        numeric (default 1)
        public
        start row
    d) lastcol
        character (XFD)
        public
        last valid column (maximum column / sheet)
    e) lastrow
        numeric (1048576)
        public
        last valid row (maximum number of rows / sheet)
    f) lOpen
        logical (default .F.)
        public
        when .T. the document is open

Download links
Function CopyToOds 2.0
Class ExportToOds 1.0

joi, 15 septembrie 2016

Copy To Ods 1.0 (OpenOffice calc spreadsheet)

General descriptio
A procedure (copytoods.prg) to export the data from a table / grid to a Open/Libre Office Calc spreadsheet  ods document (like COPY TO XLS)

The demo is testods.prg

No need for MSOffice or LibreOffice

Parameters
- cCur             - table / cursor name (data source to be exported)
- lcFileName  - name of the ods file (the result). By default SYS(2015) (optional)
- llHead          - .T. when the generated document use field names as table header;
                       - .F. field names are not included in the result By default.F. (optional)
- lcFFields     -  list of fields, when only some of the columns are exported into ods. By default all, i.e. "" (optional)
- llOpen    - .T. to launch the Calc using ShellExecute

Download link
CopyToods 1.0

miercuri, 14 septembrie 2016

Export DBF to OpenOffice / LibreOffice Writer

Both a class and a function designed to export data contained in a table or a cursor (or the content of a grid) to an odt document (a OpenOffice / LibreOffice Writer document).
 Neither the class, nor the function requires some additional software to be installed.
That means they don't use automation or ODBC / OleDB.
No need for OpenOffice, LibreOffcie or MsOffice.
Just run the code to create the desired document.

The function copyToOdt 2.0
The signature of the function is the same to the signature of CopyToDocx
Bug solved
- Export of Memo fields
Improvements
- a few minor improvements

The class ExportToOdt 1.0
The properties are the same to ExportToDocx class
Export the data displayed in a grid, or the data contained by a table / cursor

Properties
a) To export the data displayed in a grid (only the visible columns)
    Drop an instance of the exportodt class to your form and set :
    - grid=grid reference
    - label (optional)=the default file name; a reference to an object with the "caption" property; by default DATETIME()

b) To export the data contained in a table / cursor
    Drop an instance of the exportodt class to your form and set :
    - grid=table / cursor name
    - label (optional)=the default file name; a reference an object with the "caption" property; by default DATETIME()
    - cFields (optional)= list of fields to be displayed, separated by commas; by default all the fields are exported
    - cHeaders (optional)= list of field headers to be displayed, separated by commas; by default the field names

Formatting properties (right click)    headbackcolor=back color for column headers (if >=0)
    headfontbold= .T./.F.
    headfontitalic= .T./.F.
    headfontname=if not empty and installed
    headfontsize=if>0
    headforecolor=font color for column headers (if >=0)

    rowbackcolor=back color for rows (if >=0)
    rowfontbold= .T./.F.
    rowfontitalic= .T./.F.
    rowfontname=if not empty and installed
    rowfontsize=if>0
    rowforecolor=font color for rows (if >=0)

- Page settings (on right click) : size, margins and portrait / landscape
    pgLand=page orientation (landscape if .T.)
    pgSz=page size(1 A4 2 A3 3 Letter 4 Custom)
    pgMu=UM (1 inch 2 cm)
    pgh=page height (inch)
    pgw=page width (inch)
    pgTop=page top margin (inch)
    pgbottom=page bottom margin (inch)
    pgleft=page left margin (inch)
    pgright=page right margin (inch)

Miscelaneous
    lOpen
        logical (default .F.)
        public
        when .T. the document is open

Download links
Function CopyToOdt 2.0
Class ExportToOdt 1.0