@@ -183,6 +183,9 @@ func (f *File) SetCellStr(sheet, axis, value string) error {
183
183
if err != nil {
184
184
return err
185
185
}
186
+ if len (value ) > 32767 {
187
+ value = value [0 :32767 ]
188
+ }
186
189
// Leading space(s) character detection.
187
190
if len (value ) > 0 && value [0 ] == 32 {
188
191
cellData .XMLSpace = xml.Attr {
@@ -352,6 +355,7 @@ func (f *File) MergeCell(sheet, hcell, vcell string) error {
352
355
return err
353
356
}
354
357
358
+ // Correct the coordinate area, such correct C1:B3 to B1:C3.
355
359
if vcol < hcol {
356
360
hcol , vcol = vcol , hcol
357
361
}
@@ -378,9 +382,10 @@ func (f *File) MergeCell(sheet, hcell, vcell string) error {
378
382
c2 , _ := checkCellInArea (vcell , cellData .Ref )
379
383
c3 , _ := checkCellInArea (cc [0 ], ref )
380
384
c4 , _ := checkCellInArea (cc [1 ], ref )
381
- if ! c1 && ! c2 && ! c3 && ! c4 {
382
- cells = append ( cells , cellData )
385
+ if ! ( ! c1 && ! c2 && ! c3 && ! c4 ) {
386
+ return nil
383
387
}
388
+ cells = append (cells , cellData )
384
389
}
385
390
cells = append (xlsx .MergeCells .Cells , & xlsxMergeCell {Ref : ref })
386
391
xlsx .MergeCells .Cells = cells
@@ -543,10 +548,10 @@ func checkCellInArea(cell, area string) (bool, error) {
543
548
return false , err
544
549
}
545
550
546
- firstCol , firtsRow , _ := CellNameToCoordinates (rng [0 ])
551
+ firstCol , firstRow , _ := CellNameToCoordinates (rng [0 ])
547
552
lastCol , lastRow , _ := CellNameToCoordinates (rng [1 ])
548
553
549
- return col >= firstCol && col <= lastCol && row >= firtsRow && row <= lastRow , err
554
+ return col >= firstCol && col <= lastCol && row >= firstRow && row <= lastRow , err
550
555
}
551
556
552
557
// getSharedForumula find a cell contains the same formula as another cell,
0 commit comments