Text wrapping

Posted by: himavenkateshk on 29 April 2021, 5:54 pm EST

    • Post Options:
    • Link

    Posted 29 April 2021, 5:54 pm EST

    Hi,

    I am using spread with react. I need to wrap text in cell, such that when content is more than width of cell, height of the cell should increase and content fit. When we expand columns the content should be flexible. How can i achieve that ?

    By the way, i have used sheet.getCell(0,0).wordWrap(true). But it didn’t worked.

    Thanks.

  • Posted 2 May 2021, 6:06 pm EST

    Hi,

    For this, you need to use the autoFitRow after setting the wordWrap to true. Please refer to the following code snippet and attached sample that demonstrated the same.

    
    sheet1
        .getCell(0, 0)
        .value("this is the long text which hase multiple lines ")
        .wordWrap(true);
     sheet1.autoFitRow(0);
    
    

    sample:https://codesandbox.io/s/ecstatic-satoshi-3ptgr?file=/src/index.js:437-570

    autoFitRow:https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Worksheet~autoFitRow.html

    Regards

    Avinash

Need extra support?

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

Learn More

Forum Channels