Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

单元格对齐有两个方向:

  1. 水平对齐(hAlign 方法),
  2. 垂直对齐(vAlign 方法)。

你可以使用 textIndent 来设置单元格内容的缩进方式。

...

以下代码给 B2 单元格设置了水平方向和垂直方向的对齐方式,给 B3 单元格设置了缩进。 This example sets the vertical and horizontal alignment for cell B2 and specifies a text indent for cell B3.

...

JavaScript

...

Copy Code

// 设置水平居中和竖直居中

...

Code Block
languagejs
titleJavaScript
// Set the horizontal and vertical alignment to center
var cell = activeSheet.getCell(1, 1, GC.Spread.Sheets.SheetArea.viewport);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.value("Alignment");

...


//

...

 Indent the string.
cell = activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport);
cell.textIndent(2);
cell.value("Indent");

...

 

更多信息

Setting Styles
Setting Text Decoration
wordWrap Method