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

How to set the cell format ? #705

Closed
professorxin opened this issue Sep 18, 2020 · 3 comments
Closed

How to set the cell format ? #705

professorxin opened this issue Sep 18, 2020 · 3 comments

Comments

@professorxin
Copy link

cell format as example:
image

How to set the cell format to the text ?

@professorxin professorxin changed the title How can I set the cell format ? How to set the cell format ? Sep 18, 2020
@xuri
Copy link
Member

xuri commented Sep 18, 2020

You can set cell A1 as text by number format like this:

var style int
if style, err = f.NewStyle(&excelize.Style{NumFmt: 49}); err != nil {
    fmt.Println(err)
    return
}
if err = f.SetCellStyle("Sheet1", "A1", "A1", style); err != nil {
    fmt.Println(err)
    return
}

@xuri xuri closed this as completed Sep 30, 2020
@andy-cywang
Copy link

How about to set the format to Numberic? What would be the numFmt value? I cannot find the doc on this from anywhere

@xuri
Copy link
Member

xuri commented Dec 2, 2022

Sorry for my late reply, you can find more built-in number format mapping details in the documentation.

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

3 participants