Loading...
 

ODF Plug-In

Image
The ODF Plug-In allows to open spreadsheet in OpenDocument format (Apache OpenOffice/LibreOffice) into the Data Manager window component. From there, the content of the ODF files is accessible in the Quick Visualizer and in OVL by standard API (see here).

We strictly recommend to only use the new API to access ODF files from inside OVL.

As a deprecated feature, you can also use independent ODF loader classes to handle ODF files in OVL.
Therfore, first of all, the package "omix.lang.io.odf" should be imported at the beginning of the code:

import omix.lang.io.odf.*;


Then inside of a method, you can use the ODF table classes:

var file = UserRequest.getFile("*.ods");
var horizontal = true; // does spreadsheet contain a horizontal header?
var sheetIndex = 0; // in case of multiple sheets specify index. 0 is always the first sheet.
var startRow = 0; // if data table contains comment rows skip.
var excelFile = new ODFStringTable(file, horizontal, sheetIndex, startRow);

// accessing data is similar to CSV tables:
for(name in excelFile.colunns()){
    for(var i=0; i<excelFile.length();i++){
        var cellContent = excelFile.get(name, i);
        // processing cellContent...
    }
}


You can also use the types "ODFDoubleTable" and "ODFIntegerTable" in order to explicitely read real numbers and integer numbers out of the spreadsheet, respectively. In this case, "null" is returned if the corresponding cell does not contain content that can be interpreted as number.

You can also use a constructor with default values for sheetIndex (=0) and startRow (=0):

var excelFile = new ODFStringTable(file, horizontal);