qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
18.32k stars 1.71k forks source link

Cannot SetColStyle and SetColWidth at the same time #570

Closed EP-Toushirou closed 4 years ago

EP-Toushirou commented 4 years ago

Description Cannot SetColStyle and SetColWidth at the same time

Steps to reproduce the issue:

func SetColWidthAndSetStyle() {
    new_excel := excelize.NewFile()
    center_style, _ := new_excel.NewStyle(`{"alignment":{"horizontal":"center","vertical":"center"}}`)

    new_excel.SetColStyle("Sheet1", "A:Z", center_style)
    new_excel.SetColWidth("Sheet1", "A", "A", 11)

    new_excel.SaveAs("SetColWidthAndStyle.xlsx")
}

Describe the results you received: B-Z(col) is center_style, but A(col) is not. A(col)'s width changed.

if I SetColWidth first: A-Z(col) is center_style. A(col)'s width not changed.

Describe the results you expected: A-Z(col) is center_style. A(col)'s width changed.

Output of go version:

go version go1.13.7 windows/amd64

Excelize version or commit ID:

2020.02.04 new master.

Environment details (OS, Microsoft Excel™ version, physical, etc.): win10(1909), office2019(2001)

xuri commented 4 years ago

Hi @GZLHZ, thanks for your issue. I have fixed it. Please try to upgrade the library with the master branch code. This fix will be in the next release v2.1.0.

EP-Toushirou commented 4 years ago

@xuri , oh yeah, it's done.Thank you so much.

EP-Toushirou commented 4 years ago

@xuri , hi, could you please add a donate way by Alipay? image

xuri commented 4 years ago

Thank you very much. Welcome to donate this project via the one-time donations:

EP-Toushirou commented 4 years ago

Oh.It's so inconspicuous.😂 And I donated yet.😁