Prechádzať zdrojové kódy

add cell without format

rentiansheng 7 rokov pred
rodič
commit
8198acb578
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      cell.go

+ 6 - 1
cell.go

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