Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/davidgohel/flextable/llms.txt

Use this file to discover all available pages before exploring further.

valign() controls how content is positioned vertically within a cell — at the top, center, or bottom.

Function signature

valign(x, i = NULL, j = NULL, valign = "center", part = "body")

Parameters

x
flextable
required
A flextable object.
i
integer | formula | logical
Row selector. Accepts integer indices, a one-sided formula, or a logical vector. NULL selects all rows in the specified part.
j
integer | character | formula
Column selector. Accepts integer indices, column names, or a formula. NULL selects all columns.
valign
string
default:"\"center\""
Vertical alignment of the paragraph within the cell. One of:
  • "top" — align content to the top of the cell.
  • "center" — center content vertically (default).
  • "bottom" — align content to the bottom of the cell.
part
string
default:"\"body\""
Which part of the table to target: "body", "header", "footer", or "all".

Return value

The modified flextable object.

Examples

Align merged cells to the top:
ft <- flextable(iris[c(1:3, 51:53, 101:103), ])
ft <- theme_box(ft)
ft <- merge_v(ft, j = 5)
ft <- valign(ft, j = 5, valign = "top", part = "all")
ft
Align a specific row to the bottom:
ft <- flextable(head(iris))
ft <- height_all(x = ft, height = 1.3, part = "body")
ft <- hrule(ft, rule = "exact")
ft <- valign(ft, i = 3, valign = "bottom")
ft

See also

Build docs developers (and LLMs) love