This demo shows how to generate a spreadsheet from screen data. A table of data is displayed with a link below to enable the user to view the data as a spreadsheet. The link is defined by the fm:action-out function that calls ”action-download-spreadsheet”. This includes the attributes fox:widget=”link” and the prompt. You will then need the fox command <fm:generate method="preview" output-type="XLS">.
The download action starts with the FOX command <fm:generate method="preview" output-type="XLS">. This tells the FOX engine what type of file to generate. There is then a child element <fm:generate-sheet row-expr="xpath exp goes here"/> - the xpath expression targets the elements that the developer wishes to be output in each row of the spreadsheet. For example, the xpath '/LIBRARY/BOOKLIST/BOOK' will return a spreadsheet with a row for every book element it finds in the XML document. Within the generate-sheet element, there are 3 declared fm:generate-column elements. These commands tell FOX what data you want to output into the rows.
For example:
<fm:generate-column name="ISBN" column-expr="ISBN"/>
<fm:generate-column name="Book Title" column-expr="TITLE"/>.
The column-expr xpaths will be relative to the element targeted into the fm:generate-sheet xpath.