Data Plugin

OVERVIEW

The Data Plugin enables you to read, write and manipulate MS Excel® workbooks and sheets from within your Servoy solution without the need to have MS Excel® installed.

Exporting data can be done using a 2D array (vArray[][]), a dataset or a foundset

The header can be retrieved from the input dataset or set separately via an array so you can create logical headers to the user or use i18n headers.

Importing data returns a 2D array or a (again) a regular dataset.

When using the readWorkBook and writeWorkBook methods it is possible to read and write a single cell, without touching/removing the available formatting and functions.
Since version 3.3 it is also possible to create a new Excel sheet with formatting properties.

To enable adding formatting options and functions we created a formatted dataset based on a ‘normal’ dataset.

With a the called ‘FormattedDataset’ you can:

  • set cell formatting
  • set column formatting
  • set borders
  • add formula’s
  • etc.

The Data Plugin can output the following formats :

  •    XLS, XLSX, XLSM MS Excel®
  •    PDF Portable Document Format
  •    CSV Tab or comma delimited
  •    ODF Open Document Format
  •    HTML HyperText Markup Language

Next to outputting MS Excel® there are classes/methods to direct output :

  •    CSV Tab or comma delimited files
  •    DBF DataBase File files
  •    XML EXtensible Markup Language files
  •    TXT Text files

BENEFITS

  • To read, write and update MS Excel® files.
  • To script the import of data.
  • To script the export of data.
  • To automatically type cast (convert the import & export) data.

In fact whenever working with MS Excel® is necessary the Data Plugin will be your Plugin of choice.

COMPATIBILITY

Smart client Headless client Web client Mobile client NG client
8.0+ 1.6+
7.0+ 1.6+ n/a
6.1+ 1.6+ n/a n/a

DOCUMENTATION

We published our API Specifications for the Data Plug-in as a future and current reference.

After downloading the Data Plug-in using our Components Manager a sample solution {servoy_root}/solutions/it2be-examples/it2be-data.servoy is installed.
You can import the sample solution into Servoy Developer and you will have some (basic) code examples of how to use the Data Plug-in.

FAQ

I use the Data Plugin in a webclient but need a local copy of the output file.

In the below example I make use of the Tools Plugin to save the file in a ‘safe’ location on the webserver.
But you can of course use your own method for that.

By using the Servoy File Plugin as shown in the code example you can save (download) the resulting byte[] to the browser default ‘downloads’ folder.
This should do the trick!

vOutputFile = vExcel.write(plugins.it2be_tools.server().userHome + "/report.xls", null, vDataSet);</p>
<p>application.output(vOutputFile, LOGGINGLEVEL.INFO);</p>
<p>vData = plugins.file.readFile(vOutputFile);</p>
<p>vResult = plugins.file.writeFile("report.xls", vData);</p>
<p>application.output(vResult, LOGGINGLEVEL.INFO); 

RELEASE NOTES



Free Trial

Developer

$500

One developer & unlimited deployment

  • +50% p/y
    maintenance fee

Site

$900

Team of developers & unlimited deployment

  • +50% p/y
    maintenance fee