Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
38df8385
excelize
项目概览
此号慢热型
/
excelize
与 Fork 源项目一致
Fork自
xuri / excelize
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
excelize
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
已验证
提交
38df8385
编写于
7月 05, 2017
作者:
xurime
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bugfix: unable to read the value of the merged cell, relate issue #78
上级
654a676d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
17 deletion
+11
-17
cell.go
cell.go
+7
-9
excelize.go
excelize.go
+4
-8
未找到文件。
cell.go
浏览文件 @
38df8385
...
...
@@ -7,7 +7,8 @@ import (
// mergeCellsParser provides function to check merged cells in worksheet by
// given axis.
func
(
f
*
File
)
mergeCellsParser
(
xlsx
*
xlsxWorksheet
,
axis
string
)
{
func
(
f
*
File
)
mergeCellsParser
(
xlsx
*
xlsxWorksheet
,
axis
string
)
string
{
axis
=
strings
.
ToUpper
(
axis
)
if
xlsx
.
MergeCells
!=
nil
{
for
i
:=
0
;
i
<
len
(
xlsx
.
MergeCells
.
Cells
);
i
++
{
if
checkCellInArea
(
axis
,
xlsx
.
MergeCells
.
Cells
[
i
]
.
Ref
)
{
...
...
@@ -15,6 +16,7 @@ func (f *File) mergeCellsParser(xlsx *xlsxWorksheet, axis string) {
}
}
}
return
axis
}
// GetCellValue provides function to get formatted value from cell by given
...
...
@@ -23,8 +25,7 @@ func (f *File) mergeCellsParser(xlsx *xlsxWorksheet, axis string) {
// the raw value of the cell.
func
(
f
*
File
)
GetCellValue
(
sheet
,
axis
string
)
string
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
rows
:=
len
(
xlsx
.
SheetData
.
Row
)
...
...
@@ -80,8 +81,7 @@ func (f *File) formattedValue(s int, v string) string {
// index and axis in XLSX file.
func
(
f
*
File
)
GetCellFormula
(
sheet
,
axis
string
)
string
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
rows
:=
len
(
xlsx
.
SheetData
.
Row
)
...
...
@@ -114,8 +114,7 @@ func (f *File) GetCellFormula(sheet, axis string) string {
// sheet index.
func
(
f
*
File
)
SetCellFormula
(
sheet
,
axis
,
formula
string
)
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
col
:=
string
(
strings
.
Map
(
letterOnlyMapF
,
axis
))
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
...
...
@@ -141,8 +140,7 @@ func (f *File) SetCellFormula(sheet, axis, formula string) {
// and link URL address. Only support external link currently.
func
(
f
*
File
)
SetCellHyperLink
(
sheet
,
axis
,
link
string
)
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
rID
:=
f
.
addSheetRelationships
(
sheet
,
SourceRelationshipHyperLink
,
link
,
"External"
)
hyperlink
:=
xlsxHyperlink
{
Ref
:
axis
,
...
...
excelize.go
浏览文件 @
38df8385
...
...
@@ -118,8 +118,7 @@ func (f *File) SetCellValue(sheet, axis string, value interface{}) {
// name and cell coordinates.
func
(
f
*
File
)
GetCellStyle
(
sheet
,
axis
string
)
int
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
col
:=
string
(
strings
.
Map
(
letterOnlyMapF
,
axis
))
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
...
...
@@ -168,8 +167,7 @@ func (f *File) workSheetReader(sheet string) *xlsxWorksheet {
// worksheet name, cell coordinates and cell value.
func
(
f
*
File
)
SetCellInt
(
sheet
,
axis
string
,
value
int
)
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
col
:=
string
(
strings
.
Map
(
letterOnlyMapF
,
axis
))
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
...
...
@@ -203,8 +201,7 @@ func (f *File) prepareCellStyle(xlsx *xlsxWorksheet, col, style int) int {
// of characters that a cell can contain 32767 characters.
func
(
f
*
File
)
SetCellStr
(
sheet
,
axis
,
value
string
)
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
if
len
(
value
)
>
32767
{
value
=
value
[
0
:
32767
]
}
...
...
@@ -237,8 +234,7 @@ func (f *File) SetCellStr(sheet, axis, value string) {
// default format without escaping the cell.
func
(
f
*
File
)
SetCellDefault
(
sheet
,
axis
,
value
string
)
{
xlsx
:=
f
.
workSheetReader
(
sheet
)
axis
=
strings
.
ToUpper
(
axis
)
f
.
mergeCellsParser
(
xlsx
,
axis
)
axis
=
f
.
mergeCellsParser
(
xlsx
,
axis
)
col
:=
string
(
strings
.
Map
(
letterOnlyMapF
,
axis
))
row
,
_
:=
strconv
.
Atoi
(
strings
.
Map
(
intOnlyMapF
,
axis
))
xAxis
:=
row
-
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录