跳到主要内容

SetTextDirection

指定当前表格单元格的文本流动方向。

语法

expression.SetTextDirection(textDirection);

expression - 表示 ApiTableCell 类的变量。

参数

名称必需/可选数据类型默认值描述
textDirection必需TextFlowDirection文本流方向。

返回值

boolean

示例

设置 PDF 中表格单元格内文本的流动方向。

// How do I rotate text direction in a table cell in a PDF?

// Change the text orientation inside your table cell in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(2, 4);
const row = table.GetRow(0);
row.SetHeight(30 * 36000);
const cell = row.GetCell(0);
cell.SetTextDirection("tbrl");
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("This is just a sample text.");
content.Push(paragraph);

page.AddObject(table);