- CreatePromotionByExcel

This commit is contained in:
gazebo
2018-10-14 12:47:17 +08:00
parent b158fd09ea
commit 8b34b12a6e
4 changed files with 187 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ package excel
import (
"bytes"
"fmt"
"io"
"reflect"
"git.rosy.net.cn/jx-callback/business/jxutils"
@@ -66,6 +67,17 @@ func Obj2Excel(sheetList []*Obj2ExcelSheetConfig) []byte {
return buf.Bytes()
}
func Excel2Slice(reader io.Reader) (contents map[string][][]string) {
globals.SugarLogger.Debug("Excel2Slice")
if excelFile, err := excelize.OpenReader(reader); err == nil {
contents = make(map[string][][]string)
for _, v := range excelFile.GetSheetMap() {
contents[v] = excelFile.GetRows(v)
}
}
return contents
}
func genAxis(row, col int) string {
return fmt.Sprintf("%c%d", col+65, row+1)
}