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.
rotate() changes the text direction of selected cells. It supports 90-degree rotation increments and is particularly useful for compact column headers.
Function signature
Parameters
A
flextable object.Row selector.
NULL selects all rows in the specified part.Column selector.
NULL selects all columns.Text direction. One of:
"lrtb"— left to right, top to bottom (standard horizontal, the default in most output formats)."tbrl"— top to bottom, right to left (vertical, rotated 90° clockwise — text reads downward)."btlr"— bottom to top, left to right (vertical, rotated 270° clockwise — text reads upward).
Vertical alignment of the paragraph within the cell after rotation. One of
"top", "center", or "bottom". NULL leaves the current alignment unchanged.Which part of the table to target:
"body", "header", "footer", or "all".Return value
The modifiedflextable object.
Examples
Rotate header labels to save horizontal space:flextable only supports rotation in 90-degree increments (
"lrtb", "tbrl", "btlr") to ensure consistent rendering across Word, PowerPoint (which supports only 0°, 90°, and 270°), HTML, and PDF.See also
valign()— set vertical alignmentalign()— set horizontal text alignmentheight()— set row heighthrule()— control how row heights are interpreteddim_pretty()— compute optimal sizes without applying them