Browse Source

add read col style from xlsx

blackss2 10 years ago
parent
commit
b61301369f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lib.go

+ 6 - 1
lib.go

@@ -458,11 +458,16 @@ func readRowsFromSheet(Worksheet *xlsxWorksheet, file *File) ([]*Row, []*Col, in
 		// spreadsheet - we deliberately exclude these
 		// spreadsheet - we deliberately exclude these
 		// columns.
 		// columns.
 		for i := rawcol.Min; i <= rawcol.Max && i <= colCount; i++ {
 		for i := rawcol.Min; i <= rawcol.Max && i <= colCount; i++ {
-			cols[i-1] = &Col{
+			col := &Col{
 				Min:    rawcol.Min,
 				Min:    rawcol.Min,
 				Max:    rawcol.Max,
 				Max:    rawcol.Max,
 				Hidden: rawcol.Hidden,
 				Hidden: rawcol.Hidden,
 				Width:  rawcol.Width}
 				Width:  rawcol.Width}
+			cols[i-1] = col
+			if file.styles != nil {
+				col.style = file.styles.getStyle(rawcol.Style)
+				col.numFmt = file.styles.getNumberFormat(rawcol.Style)
+			}
 		}
 		}
 	}
 	}