|
@@ -117,38 +117,6 @@ func exportXLSX(mList []Matrix) (res []byte, err error) {
|
|
}
|
|
}
|
|
///////////////////////////////////
|
|
///////////////////////////////////
|
|
|
|
|
|
- // setup images
|
|
|
|
- for _, image := range matrix.Images {
|
|
|
|
- if c, err = excelize.CoordinatesToCellName(image.x+1, image.y+1); err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- format := ""
|
|
|
|
- if image.format != nil {
|
|
|
|
- format = string(image.format.JSON())
|
|
|
|
- }
|
|
|
|
- log.Println(image.ext)
|
|
|
|
- if image.ext != "" {
|
|
|
|
- var fl *os.File
|
|
|
|
- if fl, err = os.Open(image.path); err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- defer fl.Close()
|
|
|
|
- var src []byte
|
|
|
|
- if src, err = ioutil.ReadFile(image.path); err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
|
|
- if err = f.AddPictureFromBytes(sName, c, format, image.name, image.ext, src); err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if err = f.AddPicture(sName, c, image.path, format); err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ///////////////////////////////////
|
|
|
|
-
|
|
|
|
// setup columns width
|
|
// setup columns width
|
|
for _, cWidth := range matrix.ColumnsWidth {
|
|
for _, cWidth := range matrix.ColumnsWidth {
|
|
if c, err = excelize.ColumnNumberToName(cWidth.x + 1); err != nil {
|
|
if c, err = excelize.ColumnNumberToName(cWidth.x + 1); err != nil {
|
|
@@ -189,6 +157,38 @@ func exportXLSX(mList []Matrix) (res []byte, err error) {
|
|
f.AddDataValidation(sName, r)
|
|
f.AddDataValidation(sName, r)
|
|
}
|
|
}
|
|
///////////////////////////////////
|
|
///////////////////////////////////
|
|
|
|
+
|
|
|
|
+ // setup images
|
|
|
|
+ for _, image := range matrix.Images {
|
|
|
|
+ if c, err = excelize.CoordinatesToCellName(image.x+1, image.y+1); err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ format := ""
|
|
|
|
+ if image.format != nil {
|
|
|
|
+ format = string(image.format.JSON())
|
|
|
|
+ }
|
|
|
|
+ log.Println(image.ext)
|
|
|
|
+ if image.ext != "" {
|
|
|
|
+ var fl *os.File
|
|
|
|
+ if fl, err = os.Open(image.path); err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ defer fl.Close()
|
|
|
|
+ var src []byte
|
|
|
|
+ if src, err = ioutil.ReadFile(image.path); err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!")
|
|
|
|
+ if err = f.AddPictureFromBytes(sName, c, format, image.name, image.ext, src); err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if err = f.AddPicture(sName, c, image.path, format); err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ///////////////////////////////////
|
|
}
|
|
}
|
|
|
|
|
|
//r := excelize.NewDataValidation(true)
|
|
//r := excelize.NewDataValidation(true)
|