Reputation: 11
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
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