Text align in cell

Posted by: tedin_uriburu on 12 November 2019, 8:52 am EST

    • Post Options:
    • Link

    Posted 12 November 2019, 8:52 am EST

    Hi,

    I am using SpreadJS version 13, I want to align text in cells to left, at this moment they are centered, How can I align text to left?

    Thanks,

  • Posted 12 November 2019, 7:20 pm EST

    Hi,

    In SJS, text type is left aligned as the default behavior, if this is not the case in your application then make sure that you have not set the alignment explicitly.

    We could use the hAlign() method of cell range to set the alignment explicitly. Please refer to the following code snippet:

    sheet.getRange(rowIndex, colIndex, rowCount, colCount).hAlign(GC.Spread.Sheets.HorizontalAlign.left);
    

    API reference:

    • hAlign method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.CellRange~hAlign.html

    Regards

    Sharad

  • Posted 13 November 2019, 12:07 am EST

    Yeah, it worked, sorry, somebody added .hAlign = Center in some place and I just realized that. Thanks!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels