We configure and save the design of a table as a .json template. Inside this template, we are able to set various parameters in order to design the table, such as font formatting, line spacing, margins, alignment, colors, borders, etc.
This article will elaborate every supported parameter, but notice that only values that are actually needed should be defined. For instance, if a table design does not have borders, then the parameters for borders can be excluded. Parameters that are not used can either be deleted from the template or set to null
.
NB! When a table is created, it is based on the default table in the particular program and then it is formatted with the settings in the table template. For instance, if the default table in PowerPoint has bold text in first row, but the table design you are configuring should not contain bold text, it is necessary to define bold to be false in the template.
Contents
Explanation of elements [Back to top]
Use the empty table template to start configuring your table template. Here, all parameters that can be set for a table design is present. This can be copied and pasted into your .json file. When first looking at the empty table template, it can seem to be a bit overwhelming and complex, but let's break it down in its elements.
Everything we define for the table design must be inside the element called Design
. Besides this element, we have DefaultVariant
where we define the options for the table design, and lastly Variants
, which is only to be used when a table design includes variants.
Let's go back to the Design
element. We can apply a specific design in both first row, last row, first column and last column, e.g. if the table should include a header or a total row. Further, we can apply banded rows and columns, and these will often be work as variants of a table design.
Design element [Back to top]
The idea is that we first define the main design for the entire table. We use the same parameters in both FirstRow
, LastRow
, FirstColumn
, LastColumn
, BandedRow
and BandedColumns
, but these are only to be used if the design of these differs from the overall design, e.g. if the text of the first row should be bold.
The various parameters that can be defined in the Design
element are described below with examples of usage.
Background color
This parameter is used to define the background color of the cells in the table. Here, we define the color with a key from the color template. For instance, if the color template contains a color with a key called "TableBackground", this is what we set as the value. The value must be defined as a string using "
.
"BackgroundColor": {
"Key": "Background"
}
If the color is not to be defined and you want to set it to null
, remove the {}
and the Key
parameter, and set the BackgroundColor
parameter to null
. See the example below:
BackgroundColor: null
Notice: if you set "Key": null
, the program will crash.
Font
There are various parameters that can be defined for the font. First, we can define the name and size of the font. The parameter SizeOverridePp
is used if the table design is for both Word and PowerPoint, but the font size differs, e.g. if the font size is 10pt in Word it should be 12pt in PowerPoint.
Further, we can define the formatting of the text, with the parameters: Bold
, Italic
or Underline
using true
or false
.
The color of the text is defined with a key from the color template, just as the background color. The same applies for the bullet color.
"Font": {
"Name": "Arial",
"Size": 10.0,
"SizeOverridePp": 12.0,
"Bold": false,
"Italic": false,
"Underline": false,
"Color": {
"Key": "Text"
},
"BulletColor": {
"Key": "Orange"
}
}
Furthermore, we can add another parameter in order to capitalize the text. Default is false
, so this parameter should only be used when the text is to be capitalized.
"Font": { "Capitalized":true
}
Supporting East Asian font parameter
Some solutions require different font settings for Latin characters and East Asian characters. In such case, we must include several parameters, NameFarEast
and NameComplexScript
. It is possible to set the following theme fonts:
-
+Body
-
+Body Asian
- +Body CS
- +Headings
- +Headings Asian
- +Headings CS
Here is an example:
"Font": {
"Name": "+Headings",
"NameFarEast": "+Headings Asian",
"NameComplexScript": "+Headings CS",
...
}
NB: It is not possible to set the theme fonts in cells in Excel, which means that these parameters will not do any difference in tables in Excel.
Word styles
If the table design is to be used in Word, we can define styles and thus it will automatically apply the correct margin, spacing, etc. as defined in the style.
Define the name of the Word style as a string value using "
.
"WordStyle": "Table - Text"
Notice that when setting the WordStyle
parameter, the parameters for setting margins and spacing should be excluded, since these will override the settings in the style. Furthermore, the style must be present in a .docx document located next to the .json file. Read more about referring to Word styles in this article.
Excel cell formatting
If the table design is to be used in Excel, this parameter supports custom cell configuration. We refer to the options found when right clicking at a cell, clicking "Format Cells" and then selecting "Custom".
Notice that the options for the parameter is based on having United States set as region in the Language settings. When having United States set as region, you write three thousand with a ,
between the first and second digit. When region is set to Denmark, the separator is .
instead. Look at the example below.
US Region separator: 3.000
DK Region separator: 3,000
The example below defines that the table supports a thousands separator.
"ExcelCellFormatting": "#,#"
It is also possible to apply wrap text to a cell in Excel. Use true to apply wrap text, and false to remove it.
"ExcelWrapText": true
Line spacing
Within the LineSpacing
parameter, we can define the spacing and a rule for the spacing.
Here is an example:
"LineSpacing": {
"Spacing": 10,
"Rule": "LineSpaceExactly"
}
The Spacing
parameter must be defined using points. The Rule
parameter supports the following values that must be defined as a string:
Double
- which sets the line spacing to lines, at 2x the default value of 1 line of line spacing and ignores the given spacing value.LineSpaceAtleast
- which sets the line spacing to at least the given amount of points.LineSpaceExactly
- which sets the line spacing to exactly the given amount of points.Pt1_5
- which sets the line spacing to 1.5 lines of spacing and ignores the given spacing value.Single
- which sets the line spacing to 1 line of spacing and ignores the given spacing value.SpaceMultiple
- which sets the line spacing to the given amount of lines (same as setting rule to null).
Alignment
Define the alignment of the text in the table. This can be done both vertically and horizontally. All values must be defined as a string.
Here is an example:
"Alignment": {
"Horizontal": "Left",
"Vertical": "Top"
}
Vertically, we support the following values.
Top
where the text will be aligned in the top of the cells.Center
where the text will be centred in the cells.Bottom
where the text will be aligned in the bottom of the cells.
Horizontally, we support the following values:
Left
where text will be left aligned.Center
where text will be centred.Right
where text will be right aligned.Distributed
where the text is distributed evenly.Justify
where the text is justified to the left and the right.General_WdPpFallbackLeft
where the alignment is general (text will be left aligned and numbers will be right aligned) in Excel, but fall back on left in Word and PowerPoint.General_WdPpFallbackRight
where the alignment is general (text will be left aligned and numbers will be right aligned) in Excel, but fall back on right in Word and PowerPoint.General_WdPpFallbackIgnore
where the alignment is general (text will be left aligned and numbers will be right aligned) in Excel, and the fall back is ignored in Word and PowerPoint.General_WdPpCalculate
where the alignment is general (text will be left aligned and numbers will be right aligned) in Excel, and the value in the cell will be calculated as either text or number in Word or PowerPoint.
Furthermore, we are able to align data in cells according to decimals in both Word and PowerPoint. For instance,
For instance, imagine a table containing these values:
This is how it looks when the decimals are aligned:
An example can be seen here where it is configured as a button in ribbon that will align the decimals in the selected cells in a table. Thus, it is configured as a cell template that looks like this:
"Alignment": {
"Horizontal": "Left",
"Vertical": "Top",
"WdPpTab": {
"Alignment": "AlignTabDecimal",
"Position": 0
}
}
Note that for the decimal alignment to work, the horizontal alignment must be left.
There are two options for the alignment in WdPpTab
. The first one is AlignTabDecimal
, which must include a position just like in the code above. The position
is the offset from the center of the column in points. 20 means 20 points to the right of the center, while -20 means 20 points to the left of the center. Notice that 0 is a valid input. The second option is "ClearAll"
. This will overrule the settings and work as a "Remove Alignment" feature.
NB! When using this feature, ensure that regional settings are set with dot as decimal symbol and comma as digit grouping symbol.
Paragraph spacing
Define the before/after paragraph spacing in the cells of the table using the parameters below. The values must be defined in points.
"ParagraphSpacing": { "SpaceBefore": 1.0, "SpaceAfter" : 1.0 }
Margins
Define the margin for both left, right, top and bottom in the cells of the table. The values must be defined in points.
"Margin": {
"Left": 3.5,
"Top": 3.5,
"Right": 3.5,
"Bottom": 3.5
}
Note that the current implementation does not reflect these values in the cell margin dialog. Everything here will be shown as 0.0cm even though the value is set correctly.
Borders
Borders can be applied to the table in different ways, so this parameter contains several parameters in order to define where they should be applied, as well as defining the color, weight, type and visibility of the border.
Here is an example that applies both horizontal and vertical borders, except at the left and right side of the table:
"Borders": {
"Vertical": {
"Color": {
"Key": "Borders"
},
"BorderWeight": "Pt0_5",
"BorderWeightOverridePp": null,
"Type": "Solid",
"Visible": true
},
"Horizontal": {
"Color": {
"Key": "Borders"
},
"BorderWeight": "Pt0_5",
"BorderWeightOverridePp": null,
"Type": "Solid",
"Visible": true
},
"Left": {
"Color": null,
"BorderWeight": null,
"BorderWeightOverridePp": null,
"Type": null,
"Visible": false
},
"Right": {
"Color": null,
"BorderWeight": null,
"BorderWeightOverridePp": null,
"Type": null,
"Visible": false
}
}
First, we use a parameter to define where the border should be applied, and here we support the following:
Vertical
which applies borders vertically in the table.Horizontal
which applies borders horizontally in the table.Left
which will apply a border at the left side of the table.Top
which will apply a border at the top of the table.Right
which will apply a border at the right side of the table.Bottom
which will apply a border at the bottom of the table.
Within these parameters, we then define the design of the border. We define the color with a key from the color template, just as in background and font color. The weight of the border can be defined with the following string values. As an example, "Hair" and "Pt0_25" returns the same result.
Pt0_25 | |
Thin | Pt0_5 |
Pt0_75 | |
Pt1 | |
Medium | Pt1_5 |
Thick | Pt2_25 |
The BorderWeightOverridePp
is only to be used if the border weight differs in PowerPoint.
We support the following types of border styles in both Word, Excel and PowerPoint:
Solid
Dash
Dot
DashDot
DashDotDot
DashDotSlant
- this border style is not supported in PowerPoint and will evaluate to solid.Double
RoundDot
Lastly, the parameter Visible
defines the visibility of the border. If true
, the border will be applied, while it will be invisible if defined to false
. If the parameter is left out or set to null
, it will not apply a border when table is created, but if a table that already has borders is formatted, the border will be kept.
Z-index
The Zindex
parameter is supported in FirstRow
, LastRow
, FirstColumn
, LastColumn
, BandedRow
and BandedColumns
, and is only to be used if values are duplicated between some of these elements.
For instance, if the alignment in first row is set to right, but left in first column. Let's say that we then want the first cell (which is in both first row and first column) to be left aligned, the Z-index should be higher in first column in order to overrule the value in first row, e.g. it can be set to 50
in first row and 100
in first column.
"Zindex": 100
Height
The Height
parameter is supported in row templates and for FirstRow
, LastRow
, and BandedRow
in table templates. Here, we set the height of the row in points.
"Height": 30.532
Width
The Width
parameter is supported in column templates only and is used to define the width of the highlighted column.
"Width": 39.23
Banded rows and columns
Just like in the first row, first column, etc. are we able to set the same parameters as in the overall table design to apply a specific design. Nonetheless, banded rows and columns are used to shade every other row or column in the table.
It is important to notice that all of these parameters must be inside an element called Item
. Further, we have two parameters for banded rows and columns to define outside of the Item
element.
The first is Type
and it supports the following values:
BandAlwaysFirst
which ensures that to banded row/columns will always start at the first row/column, and thus overrule if design for first row/column is defined.BandFirst
which defines the banded row/column to band from the first row/column after a header row/column.BandSecond
which defines the banded row/column to band from the second row/column after a header row/column.
The second is EndType
and it supports the following values:
EndBefore
where the banding is stopped before, if there is a last row/column.EndAfter
which ensures that the banding will go after, and thus overrule if there is a last row/column.
These two parameters cannot be set to null, so if they are not to be used in the particular table template, they should be omitted.
Below is an example of how it can be configured in the table template:
"BandedRow": {
"Item": {
"BackgroundColor": {
"Key": "BandedRow"
}
},
"Type": "BandFirst",
"EndType": "EndBefore"
}
Here, the rows will be banded with the color from the key "BandedRow".
TemplateName and DefaultVariant element [Back to top]
After the Design
element, we define the name of the template using the parameter called TemplateName
. Thereafter, we have an element called DefaultVariant
, and inside this we define various options for the table.
Name of table design
The first parameter is Name
where we define the name that will be shown in menu in Word, PowerPoint or Excel. This must be defined as a string value.
Refer to color template
The second parameter is ColorThemePath
where we refer to the color template. This ensures that we can define the keys from the color template throughout the table template. Define the name of the color template as a string value. See example further below.
Table width
We can define the table width either in points using the parameter TableWidth
or in percentages using TableWidthPercentage
where a value from 0 to 1 is accepted, so instead of writing 50%, we define it as 0.5. When setting the table width in percentages, we resize the table respecting margins of the placeholder it is inserted into
Width of first column
The next parameter is FirstColumnWidth
that can be used if the first column should have another width than the remaining columns in the table. The value must be defined in points.
Height of rows
The fifth parameter is DefaultRowHeight
where we can set the default height of the rows in the table. This must be defined in points.
To ensure that PowerPoint respects this value, we must include the following parameter and value within the design property:
"FitRowHeightPp": false
This is because the default for this value is true and then sets the row height to be 1 cm as default.
Options for table design
The sixth parameter is Options
which contains several parameters, where we define whether the table design has a FirstRow
, LastRow
, FirstColumn
, LastColumn
, BandedRows
and BandedColumns
, using true
or false
. This is binary and thus it can only be set to true
or false
- not null
.
Auto fit
The seventh parameter is AllowAutoFit where we can define whether the table is allowed to auto fit using true
or false
.
Visibility of table design
Thereafter, we define which programs the table design should be visible in using these parameters:
showInWord
showInPowerPoint
showInExcel
Each parameter must be defined with true
or false
.
Indentation
Lastly, we have two parameters for the indentation. Note that this is only supported in Word.
The first parameter is IndentationStyle
which supports the following values:
- Left
- Center
- Right
The second parameter is IndentationAmount
which defines the amount of indentation in points. This can only be set if the IndentationStyle
parameter is used.
These parameters cannot be set to null, so if they are not to be used in the particular table template, they should be omitted.
Example of configuration
The example below illustrates how the parameters for the default variant can be configured and how it should be set up in the .json file.
"TemplateName": "SkabelonDesign",
"DefaultVariant": {
"Name": "Black and white",
"ColorThemePath": "SD.json",
"TableWidth": null,
"TableWidthPercentage": "1",
"Options": {
"FirstRow": true,
"LastRow": true,
"FirstColumn": true,
"LastColumn": false,
"BandedRows": false,
"BandedColumns": false
},
"ShowInWord": false,
"ShowInPowerPoint": true,
"ShowInExcel": false,
"IndentationStyle": "Left",
"FirstColumnWidth": 165.543307,
"DefaultRowHeight": 13.0393701,
"AllowAutoFit" : false
}
Variants [Back to top]
A variant is an adjustment of the main table design. The Variants element support the same parameters as in DefaultVariant.
Let's say that we have a default table design, but also need a version with banded rows, this can be configured as a variant. In this case, the parameter BandedRows will be set the false for the default variant, but true in the variant. Here is an example:
"Variants": [
{
"Name": "Grey and white",
"ColorThemePath": "SD.json",
"TableWidth": null,
"TableWidthPercentage": "1",
"Options": {
"FirstRow": true,
"LastRow": false,
"FirstColumn": true,
"LastColumn": false,
"BandedRows": true,
"BandedColumns": false
},
"ShowInWord": false,
"ShowInPowerPoint": true,
"ShowInExcel": false,
"IndentationStyle": "Center",
"IndentationAmount": null,
"FirstColumnWidth": 165.543307,
"DefaultRowHeight": 13.0393701,
"AllowAutoFit" : false
}
]
We can have as many variants for at table design as needed.
If there are several table templates and variants, it can be handy to control the ribbon menu behavior. Learn more in this article.
Comments
0 comments
Article is closed for comments.