The manual






File manipulation

The 'File' type

In Storga, files are 'File' type variables.
In the rest of this document, we assume that the variable 'f' has the type 'File', for example:

var File f

Get the file name:

var Str s := f name

Change the file name:

f name := "aute.txt"

Get file date:

var DateTime dt := f datetime

Change the date of the file (with the current time in the example below):

f datetime := datetime

Get file size:

var Int s := f size

Obtain the display mode of the file block:

var Str s := f display

Change the display mode of the file block:

f display := "open"

The keywords that define the display mode of a file block are (several can be used separated by spaces):


Visual effect


The file can be opened by clicking on it.


The contents of the file are displayed directly by Storga.


A 'Download' button is added, which allows you to download the contents of the file.


An 'Upload' button is added, which allows you to change the content of the file.

Get the title associated with the file:

var Str s := f title

Associate a title to the file:

f title := "Le logo de l'entreprise"

Get the summary associated with the file:

var Str s := f resume

Associate a summary to the file:

f resume := "Version n°3[lf]Créée le 12 novembre 2013 par Lorent"

Organize files

Browse the different file blocks of the current page or sheet

each_file f

each_file f sheet

Store the file in a page, a sheet, an email

new_file f ...

The position options that can be used by 'new_file' are the same as those used by 'new_form'.

Move it

move_file f ...

The position options usable by 'move_file' are the same as those usable by 'new_form'.

Delete it

delete_file f

Handle a file as a whole

Make a file from Storga content

f := export_as_file "identifiant_storga_de_la_page_ou_du_formulaire" "fichier.html" "options_de_formatage"

The export type is defined from the extension in the file name. The following extensions are defined:


Content export mode


As plain text.


As a CSV file (supposes that we are exporting a report and not a page or a form)


As HTML formatted text


As an editable office file.


As a file with final and fixed layout.

If you export a Storga form to PDF, you can use the keyword 'print' in formatting options to get the print version of the document.

From: Hubert Tonneau   2015-08-14 16:31:36

Préciser les options de mise en forme (bas de page pour les fichiers PDF, etc)

From: Hubert Tonneau   2015-08-14 16:32:53

Préciser l'option 'overwrite' pour l'export d'un état.

Instead of the identifier of a Storga block, 'export_as_file' can take a data of type 'Dataware' as its first argument. In this case, the possible export formats are .csv and .json.

Convert a file

The 'convert_file' function is very useful for converting between various file formats, for example from .doc to .pdf

The simplest syntax is:

var File f2 := convert_file f "foo.pdf" ""

In case of failure in the conversion, it may be interesting to recover the error code in a variable, here 'e':

var File f2 := convert_file f "foo.pdf" "" error (var Str e)

For information, the old syntax was:

var Str err := convert_file f "foo.pdf" "" (var File f2)

OCR (character recognition) function

To activate OCR, either on an image file, or to extract the text from a PDF file, we also use the 'convert_file' instruction.
In the case of a PDF file, we can use the 'layout' option which will produce a text file whose layout looks more like that of the original PDF file:

var File f2 := convert_file f "foo.txt" "layout"

Exchange a file with a server

See the client part of the article 'HTTP and FTP interface'

Provide to user

Cause a file download:

download_file f

A scenario for using this function is in a form, the user presses a button which causes the production of a file and offers the user to download its content.

Read or write the contents of a file

The end of this document specifies the functions available to read or write certain types of files. Obviously, unfortunately, Storga does not provide functions allowing to read all the types of files, nor even all the possible operations on the types of supported files. The supported file types are:








Read or write a text file

Read or write a CSV file

Creation of an XML, Json and possibly other file by substitution in an example file

Reading an XML or JSON file

Read / write to a spreadsheet file

Composition / decomposition of ZIP or PDF files