SpreadJS Documentation
Setting Cell Alignment and Indentation

You can align or indent text in a cell. You can specify the vertical and horizontal alignment using the hAlign and vAlign methods. Specify the indent using the textIndent method.

Using Code

This example sets the vertical and horizontal alignment for cell B2 and specifies a text indent for cell B3.

JavaScript
Copy Code
// Set the horizontal and vertical alignment to center
    var cell = activeSheet.getCell(1, 1, GcSpread.Sheets.SheetArea.viewport);
    cell.hAlign(GcSpread.Sheets.HorizontalAlign.center);
    cell.vAlign(GcSpread.Sheets.VerticalAlign.center);
    cell.value("Alignment");

    // Indent the string.
    cell = activeSheet.getCell(2, 1, GcSpread.Sheets.SheetArea.viewport);
    cell.textIndent(2);
    cell.value("Indent");
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.