Ver código fonte

200~New cells are added, no cell format is set

rentiansheng 7 anos atrás
pai
commit
79fb2787bc
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      cell.go

+ 6 - 1
cell.go

@@ -64,7 +64,7 @@ type CellInterface interface {
 
 
 // NewCell creates a cell and adds it to a row.
 // NewCell creates a cell and adds it to a row.
 func NewCell(r *Row) *Cell {
 func NewCell(r *Row) *Cell {
-	return &Cell{Row: r, NumFmt: "general"}
+	return &Cell{Row: r}
 }
 }
 
 
 // Merge with other cells, horizontally and/or vertically.
 // Merge with other cells, horizontally and/or vertically.
@@ -130,6 +130,11 @@ func (c *Cell) SetFloatWithFormat(n float64, format string) {
 	c.formula = ""
 	c.formula = ""
 }
 }
 
 
+// SetCellFormat set cell value  format
+func (c *Cell) SetFormat(format string) {
+	c.NumFmt = format
+}
+
 var timeLocationUTC, _ = time.LoadLocation("UTC")
 var timeLocationUTC, _ = time.LoadLocation("UTC")
 
 
 func TimeToUTCTime(t time.Time) time.Time {
 func TimeToUTCTime(t time.Time) time.Time {