Excel

Exports or imports Microsoft Excel data.

Not intended for exporting large amounts of data.

Component modes: Export | Export with Template | Import

Component mode: Export

Component exports an Excel document with a single table populated from the menu item's SQL.

Creates either a tab-separated text file or an xlsx-file, which can both be opened in Microsoft Excel.

All cells are given the Excel cell format "Text" with the following important exceptions:

  • The cell format for a column without field info is undefined.

  • Cells with an integer datatype are given the cell format "Number" with zero visible decimal places.

  • Cells with a numeric or floating point datatype are given the cell format "Number" with the number of visible decimal places given by the field info.

  • Cells with the bit datatype are given the cell format "Text" and the value ”Yes” or ”No” expressed in the users language.

  • Cells with a date/time datatype and a field type of Date or Datetime are given the cell format "Date" with the type set to the display format given by the field info.

  • Cells with a date/time datatype and a field type of Time are given the cell format "Time" with the type set to the display format given by the field info.

Exported cells are given the same allignment as specified by field info. The following CSS-attributes are supported for styling:

  • color
  • background-color
  • font-weight: bold
  • font-style: italic
  • text-decoration: underline
File modes: Download | Save | Save and download | Batch

File mode: Download

The user downloads the file.

Repeated worksheets (N/A for import mode)

By default each worksheet in an Excel template maps to one worksheet in the final document. Should you need more flexibility then you can use repeated worksheets, where a worksheet in the template maps to zero to many worksheets in the final document.

Each worksheet in the template whose name is wrapped in {} is treated as a repeated worksheet and the "Get repeated sheet" call (see below) is invoked for it. This call returns the id values and sheet names of the final sheets.

Restrictions

Repeated worksheets can not use any advanced features, including but not limited to charts, formulas and named cells.

Component settings

Document format
The format of the generated Excel file. The default value is taken from the ExcelExportDefaultDocType application variable.
Possible value Description
xlsx The document is generated as a Microsoft Excel 2007 (*.xlsx) document. InfoSql and style information will be rendered.
text The document is generated as tab separated text. InfoSql and style information will not be rendered. This mode causes a warning when opened in Microsoft Excel 2007 and later versions.

SQL

SQL Call: Excel document data (mandatory)

SQL-statement that generates the Excel-document.

May modify database: No

Parameters

@DocumentId string
This parameter is only supplied in batch mode.

Resultset: Data

Table count: repeated exactly once
Row count: zero or more rows
Columns
xxx optional string
A column with data to display in the excel document.

Resultset: Dynamic field information (optional)

Specify extra properties for the columns to export to Excel.

NOTE: In order to be compatible with grid.aspx this must be the third resultset or later, otherwise specified properties will not be applied. This means you must return an empty resultset after the data resultset in order to use this feature.
Table count: repeated zero or more times
Row count: zero or more rows
Columns
AdminFieldName mandatory string
The name of the field to apply the information to. The presence of this column indicates that the resultset specifies field information.
AllowHtml optional bit
Allow HTML.
ButtonJavaScript<xxx> optional string
Inserts a button next to the control that is used to execute the JavaScript supplied here. <xxx> is an arbitrary text that can be empty if only one button is required.
ButtonJavaScript<xxx>_Label optional string
The label for the JavaScript button <xxx>.
CellAlignment optional string

The alignment of grid columns and InfoSQL values.

Possible value Description
center Only applicable to grid columns.
left
right
ColumnTooltip optional string
Sets the tooltip on the column title. Only supported by the Grid component.
DefaultValue optional string
The default value for the control or if prefixed by 'SQL:' the sql to run to determine the default value.
DefaultValueSql optional string
SQL that evaluates default value for field. Can contain other fields for value dependency.
Description optional string
The description for the field.
EnabledJavaScript optional string
Javascript that controls the enabled status of the field. The control is only enabled if the expression specified here evaluates to true. The expression is evaluated every time the value of a dependent control is changed. This is only available to control types for which the enabled javascript field is visible in the user interface.
FieldGroupId optional int
The field group to use.
FieldInfoId optional int
ID of field information to base the dynamic field on. All properties not explicitly overridden by dynamic field information will be copied from this field. The referenced field must be found in the menu item's field tables.
FieldLabel optional string
If present the field label is used as the heading for fields instead of the field name.
FieldType optional string
The name of the control type to use. It is usually recommended to use FieldInfoId instead unless the column is used to make fields hidden or uneditable.
Possible value Description
boolean checkbox Legacy alias. Use "checkbox" instead.
boolean dropdown
chart
checkbox
checkbox tree
colorpicker
date
datetime
dropdown
file
file upload area
heading
heading with checkbox
hidden
html Legacy alias. Use "html editor" instead.
html editor
info text
listbox
multi-autosearch
multi-listbox
multi-picker
multirow
password
picture
radio buttons
radio cards
signature
textarea
textbox
textbox with autosearch
textbox with autosuggest
textbox with dropdown
textbox with popup
time
uneditable text
Height optional int
The height of the control.
IgnoreOnSave optional bit
Do not pass the field value to the insert/update procedure.
InfoSqlLayout optional string
Where the label is shown in relation to the contents in InfoSQL.
Possible value Description
Default Inherit layout from menu item.
LabelAbove Full width, label above.
LabelLeft Label to the left.
NoLabel Full width, no label.
Standard Deprecated. Use LabelLeft instead.
MandatoryJavaScript optional string

JavaScript that controls the mandatory status of the field, this overwrites nullchoice if set. This is only available to control types for which the mandatory JavaScript field is visible in the user interface.

MaxDate optional date
Only applicable to the Date and Datetime controls.
MinDate optional date
Only applicable to the Date and Datetime controls.
NullChoice optional bit
Specifies whether the control allows null values.
NumberOfDecimals optional int
The number of decimals to display for numeric values.
OnChangeJavaScript optional string
Javascript run when the value of the control has changed.
OutputFormat optional string
Special formatting to be applied when the field is displayed.
Possible value Description
Hyperlink
MailToLink
PhoneLink
Placeholder optional string
Text shown when the field is empty.
Sql optional string
The SQL that determines the control's behavior. (Refer to control documentation for more information)
TextDirection optional string

Which direction the script is written in. Not to be confused with the CellAlignment property.

Possible value Description
default System default. Not useful unless you are trying to override an already explicit text direction on existing field information.
ltr Left-to-right (for example English)
rtl Right-to-left (for example Arabic)
ThousandDelimiter optional string
The thousand grouping delimiter for numeric values.
TimePickerFrom optional string
Only applicable to the Time and Datetime controls.
TimePickerTo optional string
Only applicable to the Time and Datetime controls.
Width optional int

The width of the control.

At one point, this was a pixel value. Back when Softadmin used Verdana 10px, and before fields had width-categories. Now, it is just a value that is converted to a width category.

The possible values listed below are just suggestions. For example, both 1 and 30 will be converted to shortest, and both 500 and 9999 to longest.

Possible value Description
150 Medium-long
30 Shortest
300 Long
500 Longest
60 Short
90 Medium short
VisibleJavaScript optional string
JavaScript that controls the visibility of the field. The control is only visible if the expression specified here evaluates to true. The expression is evaluated every time the value of a dependent control is changed.

Resultset: File name (optional)

Table count: repeated zero or one time
Row count: zero or one row
Columns
ADMINFilename optional string
Name to use for the exported Excel document. Should not end with a file extension.

SQL Call: Validate parameters

Allows you to validate the SQL parameters before any other SQL is run in the component. This call is only made if the SQL is a stored procedure and Validate parameters is checked.

May modify database: No

Parameters

@Force bit
Set to 1 if the last call to validate parameters used admin_force and the user clicked OK in the OK/Cancel dialog.
@ValidateParams bit
Set to 1 when this call is made.

Resultset: Messages (optional)

Table count: repeated zero or one time
Row count: zero or one row
Columns
ADMIN_Force optional string
Message asking the end user to confirm their parameters.
ADMIN_Message optional string
Message explaining why the parameters are rejected.

Custom access control and logging

SQL Call: Custom access control and logging

Use this call to restrict which entries a user is allowed to view and edit, and to log which entries a user views.

Access to a menu item is normally controlled through functions and roles alone but some entities need more fine grained control. For example, a user may have access to the View Member menu item for normal members but not for members with a protected identity.

The menu items a user visits are always logged (in ADMINLogMenuItem) but for sensitive data you may need to log exactly what entries are viewed. Do the logging in this call as the common ways of viewing data (grid and InfoSQL) are not allowed to modify the database.

If you bind a scalar function instead of a stored procedure to this call then its name must end with '_GrantAccess'.

May modify database: Yes

Resultset: Access permissions

Return whether the user is allowed to visit the menu item with the current parameters.
Table count: repeated exactly once
Row count: exactly one row
Columns
GrantAccess mandatory bit
1 if the user is allowed to view the menu item, 0 if the user should not be allowed to view the menu item.

If 0 then an error will be logged as the user should not have been able to reach the menu item with the given parameters in the first place.