Table

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.

Basic Code Sample

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)
});

TableSetting Options

PropertyTypeDetails

name

string

Table Internal name for reference. Default: Table 1

height

uint

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

width

uint

Table overall width in EMU Default : 8128000

x

uint

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

y

uint

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

widthType

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

tableColumnWidth

List<float>

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

TableRow Options

PropertyTypeDetails

height

int

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

rowBackground

string?

Configure row background color using hex code (without #).

textColor

string

Configure row text color using hex code (without #).

tableCells

List<TableCell>

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

TableCell Options

PropertyTypeDetails

value

string?

Value of specific table cell

rowSpan

uint

Number of cell Rows of same column to be merged

columnSpan

uint

Number of cell Columns to be merged in same row

horizontalAlignment

HorizontalAlignmentValues?

Horizontal alignement property

verticalAlignment

VerticalAlignmentValues?

Vertical alignement property

borderSettings

Table Border setting options

cellBackground

string?

Cell Specific background color

textColor

string

Cell Specific text color

fontFamily

string

Cell Specific font family

fontSize

int

Cell Specific font size

isBold

bool

Set cell content bold

isItalic

bool

Set cell content Italic

isUnderline

bool

Set cell content underline status

TableBorderSettings Options

PropertyTypeDetails

leftBorder

Left Border Related Setting

topBorder

Top Border Related Setting

rightBorder

Right Border Related Setting

bottomBorder

Bottom Border Related Setting

topLeftToBottomRightBorder

TODO

bottomLeftToTopRightBorder

TODO

TableBorderSetting Options

PropertyType

showBorder

bool

Set border status

borderColor

string

Set border color

width

float

Set border width

borderStyle

BorderStyleValues

Border line style

dashStyle

DrawingPresetLineDashValues

Border dash style

WidthOptionValues *Width Type additional Details

OptionBehaviour

AUTO

Ignore User Width value and space the colum 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

PERCENTAGE

0-100 Width percentage split for each column

RATIO

0-10 Width ratio of each column