劉世斌
劉世斌

Reputation: 11

How can i wraptext to the new row in excelize

as athor answer on internet

people doing the `

WrapText: true

` to make WrapText in a cell, but today,I want to WrapText to a new row, and when i type "/n" in cell ,code will wrapText to a new row.

this is what i expecting: enter image description here can finally becom this enter image description here and this is my code `

paymentTermStyle, _ := f.NewStyle(`{
        "alignment":{
            "wrap_text":true
        },
        "font": {
            "family": "Times New Roman"
          }
    }`)

    f.SetCellStyle("PI", "A48", "A48", paymentTermStyle)

` thanks for helping

Upvotes: 0

Views: 773

Answers (1)

Erid
Erid

Reputation: 1

add "WrapText:true" in excelize.Style struct like this

paymentTermStyle, _ := f.NewStyle(&excelize.Style{
Alignment: &excelize.Alignment{
            Horizontal: "center",
            Vertical:   "center",
            WrapText:   true,
        },
        Font: &excelize.Font{Size: 11, Bold: true},
    })
  f.SetCellStyle("PI", "A48", "A48", paymentTermStyle)

Upvotes: 0

Related Questions