浏览代码

solve ending space missing

heiy 6 年之前
父节点
当前提交
810139f5fc
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      cell.go

+ 1 - 1
cell.go

@@ -229,7 +229,7 @@ func (f *File) SetCellStr(sheet, axis, value string) error {
 		value = value[0:32767]
 	}
 	// Leading space(s) character detection.
-	if len(value) > 0 && value[0] == 32 {
+	if len(value) > 0 && (value[0] == 32 || value[len(value)-1] == 32) {
 		cellData.XMLSpace = xml.Attr{
 			Name:  xml.Name{Space: NameSpaceXML, Local: "space"},
 			Value: "preserve",