Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text isn't set to bold #1087

Closed
laker31 opened this issue Dec 8, 2021 · 7 comments
Closed

Text isn't set to bold #1087

laker31 opened this issue Dec 8, 2021 · 7 comments

Comments

@laker31
Copy link

laker31 commented Dec 8, 2021

I saw that this was previously reported in issue #1059, but I just downloaded the latest version of excelize today and it still doesn't work.

I set the font to green and bold with this:

            Font: &excelize.Font{
                Bold: true,
                Color: "00FFAA",
            },

When I apply the style to the cells, the text is set to green but it is not bold. Am I doing something wrong?

@xuri
Copy link
Member

xuri commented Dec 9, 2021

Thanks for your feedback, did you try with master branch code? I have tested and it works well with Apple Numbers 11.2 (7032.0.145), could you show us a complete, standalone example program or reproducible demo?

@xuri xuri added the needs more info This issue can't reproduce, need more info label Dec 9, 2021
@laker31
Copy link
Author

laker31 commented Dec 9, 2021

Thanks for replying @xuri. I apologize, but could you explain, how can I make sure I am using the master branch code?

@xuri
Copy link
Member

xuri commented Dec 9, 2021

Please upgrade to master branch code by following command:

go get -u github/xuri/excelize/v2@master

@laker31
Copy link
Author

laker31 commented Dec 9, 2021

After doing this:

go get -u github.com/xuri/excelize/v2@master

and using this code:

package main

import (
    "github.com/xuri/excelize/v2"
)

func main() {
    f := excelize.NewFile()

    f.SetCellValue("Sheet1", "A1", "Column A")
    f.SetCellValue("Sheet1", "B1", "Column B")
    f.SetCellValue("Sheet1", "C1", "Column C")
    f.SetColWidth("Sheet1", "A", "C", 15)
    f.SetRowHeight("Sheet1", 1, 40)

    styleHeaders, _ := f.NewStyle(`{ "border": [ { "type": "left", "color": "000000", "style": 1 }, { "type": "right", "color": "000000", "style": 1 }, { "type": "top", "color": "000000", "style": 1 }, { "type": "bottom", "color": "000000", "style": 1 } ], "fill": { "type": "pattern", "pattern": 1, "color": ["#D3D3D3"] }, "font": { "bold": true, "color": "000000" }, "alignment": { "horizontal": "center", "vertical": "center", "wrap_text": true } }`)
    styleContentCells, _ := f.NewStyle(`{ "border": [ { "type": "left", "color": "000000", "style": 1 }, { "type": "right", "color": "000000", "style": 1 }, { "type": "top", "color": "000000", "style": 1 }, { "type": "bottom", "color": "000000", "style": 1 } ], "alignment": { "horizontal": "center", "vertical": "center", "wrap_text": true } }`)

    f.SetCellStyle("Sheet1", "A1", "C1", styleHeaders)
    f.SetCellStyle("Sheet1", "A2", "C31", styleContentCells)

    f.SaveAs("Test.xlsx")

}

the text in the header cells still isn't set to bold. Every other style setting works (for example, setting the border to be black and thick, setting the header fill colour to be grey, etc.).

@xuri
Copy link
Member

xuri commented Dec 10, 2021

Which version of Apple Numbers are you using? Could you try to upgrade to the lasted version?

@laker31
Copy link
Author

laker31 commented Dec 10, 2021

I did upgrade to the latest version of Apple Numbers but it still doesn't work.

Does using the following command ensure I will use master branch code?

go get -u github.com/xuri/excelize/v2@master

@laker31
Copy link
Author

laker31 commented Dec 10, 2021

I managed to use the version on master of the package (and the headers are now in bold) by adding the following line to my go.mod, then running go mod tidy.

replace github.com/xuri/excelize/v2 => github.com/xuri/excelize/v2 master

@laker31 laker31 closed this as completed Dec 10, 2021
@xuri xuri removed the needs more info This issue can't reproduce, need more info label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants