xls

Create a new Excel file.

XLS

NAME

xls - Create a new Excel file.

SYNOPSIS

xls_new()

xls_set(xls: valuex:1, y:1, number:1, str:"string value", border:BORDER_TOP, align:ALIGN_CENTER)

xls_write(xls: value)

xls_free(xls: value);

DESCRIPTION

These function are used to create an excel file.

xls_new return a variable that will be used by all other functions.

xls_set is used to set a cell at (x,y) with a number or a string. A border and alignment can also be specified. The valid values are defined in file /includes/extenso.sn:

// Alignament options for a cell to be used with xls functions
%define ALIGN_GENERAL                           0;
%define ALIGN_LEFT                              1;
%define ALIGN_CENTER                            2;
%define ALIGN_RIGHT                             3;
%define ALIGN_FILL                              4;
%define ALIGN_MULTIPLAN_DEFAULT                 7;

// the border values for a cell to be used with xls functions
%define BORDER_LEFT                             0x08;
%define BORDER_RIGHT                            0x10;
%define BORDER_TOP                              0x20;
%define BORDER_BOTTOM                           0x40;

xls_write is use to write a file. This file must not exist. If the file exist IT IS not ovwerwritten.

xls_free is use to free memory used by functions.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{ a=xls_new(); xls_free(a);}}.), qq(res=.));

res={_{ a=xls_new(); xls_set(x:1,y:1,str:"test");xls_free(a);}}. return Parameter xls is not defined

res={_{ a=xls_new(); xls_set(xls:a,x:1,y:1,str:"test");
                xls_write("/html/test.xsl");xls_free(a);}}. return Positional parameter 1 is not valid in xls_write

res={_{ a=xls_new();
        xls_set(xls:a,x:1,y:1,str:"test");
        xls_write(file:"/html/test.xls");xls_free(a);}}. return Parameter xls is not defined


res={_{
        %include "/includes/extenso.sn";
        remove("/html/test.xls");
        a=xls_new();
        xls_set(xls:a,x:1,y:1,str:"test");
        xls_set(xls:a,x:1,y:2,number:1.2);
        xls_set(xls:a,x:2,y:2,str:"Pierre");
        xls_set(xls:a,x:2,y:2,border:BORDER_LEFT | BORDER_RIGHT,align:ALIGN_CENTER);
        xls_write(xls:a,file:"/html/test.xls");xls_free(a);}}.

SEE ALSO

{{ include("includes/strings.sn") }}

{{ include("includes/files.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.