Skip to content

This content is for v4.x (Alpha). Switch to the Stable version.

The Table class, a dynamic feature within the OpenXMLOffice.Presentation library, provides developers with a robust toolset for effortlessly incorporating tables into PowerPoint presentations. This class offers extensive support for diverse table configurations, allowing users to create, modify, and enhance tables in a slide with ease. Developers can leverage the Table class to add new tables.

Slide slide = powerPoint.AddSlide(PresentationConstants.SlideLayoutType.BLANK);
slide.AddTable(CreateTableRowPayload(10), new TableSetting()
{
name = "New Table",
widthType = TableSetting.WidthOptionValues.PERCENTAGE,
tableColumnWidth = new() { 80, 20 },
x = (uint)G.ConverterUtils.PixelsToEmu(10),
y = (uint)G.ConverterUtils.PixelsToEmu(10)
});
PropertyTypeDetails
namestringTable Internal name for reference. Default: Table 1
heightuint

Table overall height in EMU.
Note: If the specified height is insufficient, the PowerPoint (PPT) application will automatically use the minimum required height.
Default : 741680

widthuintTable overall width in EMU
Default : 8128000
xuint

This parameter precisely determines the X position of the entire chart. Default: 0

yuint

This parameter precisely determines the Y position of the entire chart. Default : 0

widthTypeWidthOptionValues

This parameter affects how value in tableColumnWidth is been used. Refer additional details.
Default : Auto

tableColumnWidthList<float>

The float value is accessed or ignored based on widthType setting.

PropertyTypeDetails
heightint

Configures row height, measured in EMU (English Metric Unit).
Default : 370840

rowBackgroundstring?Configure row background color using hex code (without #).
textColorstringConfigure row text color using hex code (without #).
tableCellsList<TableCell>

Contains the list of cell that needs to be inserted into the current row.

PropertyTypeDetails
valuestring?Value of specific table cell
rowSpanuintNumber of cell Rows of same column to be merged
columnSpanuintNumber of cell Columns to be merged in same row
horizontalAlignmentHorizontalAlignmentValues?Horizontal alignment property
verticalAlignmentVerticalAlignmentValues?Vertical alignment property
borderSettingsTableBorderSettingsTable Border setting options
cellBackgroundstring?Cell Specific background color
textColorstringCell Specific text color
fontFamilystringCell Specific font family
fontSizeintCell Specific font size
isBoldboolSet cell content bold
isItalicboolSet cell content Italic
isUnderlineboolSet cell content underline status
PropertyTypeDetails
leftBorderTableBorderSettingLeft Border Related Setting
topBorderTableBorderSettingTop Border Related Setting
rightBorderTableBorderSettingRight Border Related Setting
bottomBorderTableBorderSettingBottom Border Related Setting
topLeftToBottomRightBorderTableBorderSettingTODO
bottomLeftToTopRightBorderTableBorderSettingTODO
PropertyType
showBorderboolSet border status
borderColorstringSet border color
widthfloatSet border width
borderStyleBorderStyleValuesBorder line style
dashStyleDrawingPresetLineDashValuesBorder dash style

WidthOptionValues *Width Type additional Details

Section titled “WidthOptionValues *Width Type additional Details”
OptionBehavior
AUTOIgnore User Width value and space the column equally.
EMU

(English Metric Units) Direct PPT standard Sizing 1 Inch * 914400 EMU’s

PIXEL

Based on Target DPI the pixel is converted to EMU and used when running

PERCENTAGE0-100 Width percentage split for each column
RATIO0-10 Width ratio of each column