Comments (4)
Thanks for your issue. This was duplicated with issue #705, 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
}
This library also support set multiple cell's style by SetColStyle
and SetRowStyle
functions.
from excelize.
I am not sure what this means: should the method SetCellStr
do this actually, or should cell styling do this?
What does NumFmt 49 do btw?
from excelize.
The SetCellStr
function used for accept Go language's string data type value, this function won't affect the format of the cell, so if you need set cell style with specified number format, may need to create the style with number format by the NewStyle
function at first, and you will get a style index, and then set cells style with that. The excelize library supports create style with number format by built-in number format index or custom number format code, the number 49
represents the "Text" format. As the comments in issue #705 say, you can find more built-in number format mapping details on the documentation website.
from excelize.
Ok, thanks!
from excelize.
Related Issues (20)
- concurrent use GetCellStyle got panic:index out of range HOT 2
- How can I set the `Fill` color for pie chart ? HOT 2
- When calling `Save` more than once on an already formatted Excel, the values are saved on unexpected cells HOT 2
- Different PieChart parts color and legend colors HOT 2
- Reduce Binary Size HOT 2
- Spark lines duplicate when creating spark lines on multiple sheets HOT 2
- Corrupted file HOT 2
- The brackets will be missing when setting up the arithmetic formula with brackets. HOT 1
- DuplicateRow() causes the parentheses to be lost in the formula of the row being duplicated HOT 1
- Excelize v2.8.1 is causing process restart with performance data HOT 1
- Date Cells in Excel Exported as Numbers Instead of Dates HOT 2
- Reproducing tutorial the spreadsheet is empty HOT 1
- Combo Column + Line chart with secondary invisible axis produces unexpected results. HOT 1
- function MergeCell() didn't truly merge HOT 2
- Generated corrupted Excel file on go1.21.5, excelize v2.8.1 HOT 3
- Secondary axis title is not displayed. HOT 2
- StreamChunkSize(16MB) variable setting function HOT 1
- support xlsb file format HOT 1
- GetCellType for date format cell value returns as Unset HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excelize.