瀏覽代碼

Tweaked the row height custom flag

Colin Fox 10 年之前
父節點
當前提交
760e459008
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 6 4
      row.go
  2. 1 1
      sheet.go

+ 6 - 4
row.go

@@ -1,14 +1,16 @@
 package xlsx
 
 type Row struct {
-	Cells  []*Cell
-	Hidden bool
-	Sheet  *Sheet
-	Height float64
+	Cells    []*Cell
+	Hidden   bool
+	Sheet    *Sheet
+	Height   float64
+	isCustom bool
 }
 
 func (r *Row) SetHeightCM(ht float64) {
 	r.Height = ht * 28.3464567 // Convert CM to postscript points
+	r.isCustom = true
 }
 
 func (r *Row) AddCell() *Cell {

+ 1 - 1
sheet.go

@@ -110,7 +110,7 @@ func (s *Sheet) makeXLSXSheet(refTable *RefTable, styles *xlsxStyleSheet) *xlsxW
 		}
 		xRow := xlsxRow{}
 		xRow.R = r + 1
-		if row.Height > 0 {
+		if row.isCustom {
 			xRow.CustomHeight = true
 			xRow.Ht = fmt.Sprintf("%g", row.Height)
 		}