Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Commit 1659caf

Browse files
committed
Handle unsigned ints
1 parent e41b457 commit 1659caf

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ func (c *Cell) SetValue(n interface{}) {
396396
switch t := n.(type) {
397397
case time.Time:
398398
c.SetDateTime(t)
399-
case int, int8, int16, int32, int64:
399+
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
400400
c.SetNumeric(fmt.Sprintf("%d", n))
401401
case float64:
402402
// When formatting floats, do not use fmt.Sprintf("%v", n), this will cause numbers below 1e-4 to be printed in

write.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ func (r *Row) WriteSlice(e interface{}, cols int) int {
7171
}
7272
default:
7373
switch val.Kind() { // underlying type of slice
74-
case reflect.String, reflect.Int, reflect.Int8,
75-
reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float64, reflect.Float32:
74+
case reflect.String,
75+
reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
76+
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
77+
reflect.Float64, reflect.Float32:
7678
cell := r.AddCell()
7779
cell.SetValue(val.Interface())
7880
case reflect.Bool:
@@ -153,8 +155,10 @@ func (r *Row) WriteStruct(e interface{}, cols int) int {
153155
}
154156
default:
155157
switch f.Kind() {
156-
case reflect.String, reflect.Int, reflect.Int8,
157-
reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float64, reflect.Float32:
158+
case reflect.String,
159+
reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
160+
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
161+
reflect.Float64, reflect.Float32:
158162
cell := r.AddCell()
159163
cell.SetValue(f.Interface())
160164
case reflect.Bool:

0 commit comments

Comments
 (0)