All data types supported by the spreadsheet export are listed in the
sap.ui.export.EdmType
enumeration. During the export, the values
are converted to a value that is in compliance with the Office Open XML
requirements.
String
The type string
handles
textual values within cells. Strings are usually not formatted. The
internal
type text is the default type that gets applied if no other type
is configured for a column.
It is possible to aggregate several property values into one column, for example,
firstname
and lastname
are combined to
fullname
. This can be achieved by providing an array of
property names within the property
property of the column
definition. In addition to that, the template
property must be made
available. This additional property has to be a non-empty string and can contain
placeholders. A placeholder is a numerical index enclosed by curly brackets. The
index must be greater than or equal zero and less than the length of the array that
is assigned to the property
property.
Additional Property |
Type |
Sample |
Optional |
Description |
---|---|---|---|---|
|
|
|
Yes |
Used as a regular expression that determines specific parts of the original value. This makes it possible to apply the template to a single property instead of multiple properties.
|
|
|
|
Yes |
A textual template that can be filled with multiple values from various business objects. Each placeholder is a number within curly brackets that represents an index of a property array. |
|
|
|
Yes |
A Boolean value that indicates if the text column supports wrapping of the cell content. Apart from automatic text wrapping depending on the cell width, it automatically converts all \n to \r\n line breaks. These manual line breaks are then visible in the generated xlsx file. |
Here is an example for a string
column:
var exportConfiguration = { workbook: { columns: [ { property: ["Firstname", "Lastname"], label: "Full name", width: 25, template: "{1}, {0}" } ] } } // This will result in "Doe, John" if the line item is {Firstname: "John", Lastname: "Doe"}
Boolean
The type boolean
handles all variations of Boolean values. It allows for
displaying these Boolean values in a pre-defined format. There are additional
properties that are handled by this type to format their respective values. Since a
boolean
type can be either true
or
false
,
the
additional properties must be maintained for both cases for the type to take
effect.
Additional Property |
Type |
Description |
---|---|---|
|
|
Defines the textual representation of a Boolean type that has the
value |
|
|
Defines the textual representation of a Boolean type that has the
value |
Here is an example for a boolean
column:
var exportConfiguration = { workbook: { columns: [ { property: "Onstock", label: "Availability", type: sap.ui.export.EdmType.Boolean, trueValue: "On stock", falseValue: "Out of stock" } ] } }
The type number
represents a simple numeric value without any
specific formatting. The value is displayed
the
way it is. For further adjustment use the additional properties
scale
, delimiter
, unit
, and
unitProperty
.
Additional Property |
Output Sample |
Type |
Optional |
Description |
---|---|---|---|---|
|
1234 1234.5 1234.56 1234.567 |
|
Yes |
Sets a fixed amount of decimals. The scale is applied to the whole column and displays exactly the number of decimals that is configured. If the actual value has fewer or more decimal places, it is filled with additional zeros or gets cut off to match the configured amount of decimals. This property accepts a positive integer value. Negative values are treated like zero. |
|
1,234 1,234,567 |
|
Yes |
Specifies if the numeric value is shown in groups of thousands.
If set to |
|
623 kg 89 % 120 km/h |
|
Yes |
Specifies the unit of measurement (UoM). The UoM is shown next to the numeric value.
The UoM is treated as a string and therefore has no influence on the value itself. For %, mio, or similar UoMs this can make a difference if the values are used in forms because multiplying by 150 % would mean x * 150 instead of x * 1.5. |
|
623 kg 89 % 120 km/h |
|
Yes |
References a business object property that contains the UoM for this particular numeric type. |
Here is an example for a number
column:
var exportConfiguration = { workbook: { columns: [ { property: "Weight", label: "Net weight (kg)", type: sap.ui.export.EdmType.Number, unit: "kg", scale: 3 }, { property: "Weight", label: "Net weight (g)", type: sap.ui.export.EdmType.Number, unit: "g", scale: 0, delimiter: true } ] } }
Date
, Time
, and
DateTime
The types date
, dateTime
, and time
handle the date and time information. The application can pass additional parameters
to adjust the visible representation of these types.
Type |
Output Sample |
Description |
---|---|---|
|
03/24/2017 24.03.2017 |
Represents a date without time-related information. Due to the
use of built-in formats, |
|
08/31/2016 23:01 31.08.2016 23:01 |
Represents values that contain date- and time-related
information. Due to the use of built-in formats,
The locale has no effect on any time zone formatting. All values
in columns of type |
|
13:21:14 |
Represents values that contain time-related information only. Time information can use
the following units: hours, minutes, seconds, and milliseconds.
Contrary to |
Additional Property |
Type |
Optional |
Description |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Yes |
Allows users to choose a calendar other than the Gregorian calendar. The following values are possible:
Choosing a calendar other than the Gregorian calendar overrides
all type settings, such as the type or format
template,
for various reasons. Islamic and Japanese representation only
takes effect if the displayed
|
||||||||||
|
|
Yes |
Defines a specific format that gets applied to
The format template needs to match the following regular expression to be valid:
The list below shows some sample formats and their output:
Office Open Spreadsheet dates can't handle time zone offset information. |
||||||||||
|
|
Yes |
Allows you to parse a textual date representation based on a given pattern. The pattern has to be provided as a string with the literals y, m, d. Other literals are ignored.
|
Here is an example for a date/dateTime/time
column:
var exportConfiguration = { workbook: { columns: [ { property: "Duedate", label: "Due date (islamic)", type: sap.ui.export.EdmType.Date, calendar: "islamic" }, { property: "Createdat", label: "Created at", type: sap.ui.export.EdmType.DateTime, format: "dddd, d.mmmm yyyy" }, { property: "Dailymeeting", label: "Daily meeting", type: sap.ui.export.EdmType.Time}, }, { property: "stringDate", label: "Textual date representation", type: sap.ui.export.EdmType.Date, inputFormat: "yyyymmdd" } ] } }
The type currency
handles currencies as an aggregation of a value
and a particular UoM. This type might apply various styles on cell level because the
scale of each currency cell depends on the corresponding UoM which in turn might
vary for various cells in a currency column. The currency
type
inherits from the number
type but provides additional properties,
including the unitProperty
property as a mandatory property.
Additional Property |
Type |
Mandatory |
Description |
---|---|---|---|
|
|
Yes |
References the business object property that contains the UoM for this particular currency. This property is required even if the UoM is not displayed. |
|
|
No |
Defines if the UoM is shown in the column. If set to
|
|
|
No |
Property that is equivalent to the |
Here is an example for a currency
column:
var exportConfiguration = { workbook: { columns: [ { property: "Amount", label: "Price", unitProperty: "Currency" } ] } }
The type enumeration
is used for mapping values to a particular key. This is
useful if your SAPUI5
application is using formatters instead of raw data to display meaningful content
because formatters are not supported directly.
Additional Property |
Type |
Mandatory |
Description |
---|---|---|---|
|
|
Yes |
Contains |
Here is an example for an enumeration
column:
var exportConfiguration = { workbook: { columns: [ { property: "Shipping", valueMap: { a: "Standard Shipping", b: "Premium Shipping", c: "Express Shipping" } } ] } }
The type BigNumber
is used to represent numbers that contain more
than 15 digits. This data type is required because of the internal number
representation of Microsoft Excel as defined by the IEEE (Institute of Electrical
and Electronics Engineers). This means that all numbers that contain more than 15
digits are filled with zeros at the end. This affects precision of the values
although the difference is really small compared to the total amount. The
BigNumber
type inherits from the Currency
type
and uses the same properties as currency
and its superordinate
class Number
. This type creates a textual output which is why it is
not possible to do any calculation with these values.