Appendix: Using an Asset to Define the Exported Data's Structure
To export data source values as an Excel spreadsheet, you must first define the intended spreadsheet's structure using an HTML-based Markup Asset.
Begin by opening the Site Map Inspector, and select File > New > Asset > Markup.
Creating a new markup asset.
This opens a dialog that prompts you to name the new asset and provide a description.
Switch to the HTML Content panel in the dialog, and enter the following syntax to write the asset's markup in the HTML Editor:
<%# PROPERTIES(
Name="AssetName"
A="Keyword|Header"
B="Keyword|Header"
C="Keyword|Header") %>
The markup that defines the structure of a data source's Excel output.
The second line of this markup defines the Name property, which should be set to the name of the HTML markup asset itself. For example, if the asset is called AssetName, that should be the value you assign to this property.
Following this, you will need to define properties representing the columns you want to include in the exported Excel spreadsheet. There is no practical limit to the number of column properties you can define here, as long as each one corresponds with a field in your data source. Define each of your column properties using the following syntax:
Column="Keyword|Header"
- Column - This is the letter (or letters, e.g. "AA") of the column in the Excel document where you want the corresponding data source field's values to appear.
"A" represents a spreadsheet's first column, "B" its second column, and so on.
- Keyword - This is the alias of the data source field you want to map to the chosen column.
- Header - This is the text you want to appear in the first row of the column, representing the mapped data's header text.
When you have defined properties for all of the columns you want to include in the exported Excel spreadsheet, Save and Publish the markup asset. This asset can now be used by the ExportDataSourceAsExcelDownload and ExportDataSourceAsExcelBase64 functions.