tealeg / xlsx

Go library for reading and writing XLSX files.
Other
5.81k stars 810 forks source link

how to set border for merge cell #721

Closed lucky51 closed 9 months ago

lucky51 commented 3 years ago

how to set border for merge cell

        file :=xlsx.NewFile()
    sheet,err:=file.AddSheet("test")
    defer sheet.Close()
    FailureOnError(err,"Failure on Add sheet")
    row:=sheet.AddRow()
    first:=row.AddCell()

    first.Merge(7,0)
    first.SetString("merge cell value")

    row.SetHeight(30)

    style:= xlsx.NewStyle()
    style.Border = *xlsx.NewBorder("thin","thin","thin","thin")
    style.ApplyBorder = true
    first.SetStyle(style)
    file.Save("test.xlsx")

output

image

why merge cell no right border

lucky51 commented 3 years ago

in xlsx lastest version : v3.2.3

github-actions[bot] commented 1 year ago

Stale issue message

yangjob commented 10 months ago

is there any solutions?

tealeg commented 10 months ago

In cases like this, my approach was always to create an example that works (using Excel or OpenOffice), then take a look at the XLSX it produced to see how it differed from what the generated output from this library was. That would give us better insight into the issue.

yangjob commented 10 months ago

@tealeg first I merge the cell of interface or object, then I set the cell style, but the width of the border on the top or bottom is only one cell before merged image