Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
ca43c651
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,发现更多精彩内容 >>
已验证
提交
ca43c651
编写于
7月 19, 2020
作者:
xurime
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update test for addTable
上级
c922c32f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
16 deletion
+13
-16
lib.go
lib.go
+1
-4
table.go
table.go
+2
-8
table_test.go
table_test.go
+6
-0
xmlDrawing.go
xmlDrawing.go
+4
-4
未找到文件。
lib.go
浏览文件 @
ca43c651
...
...
@@ -396,10 +396,7 @@ func (f *File) addNameSpaces(path string, ns xml.Attr) {
if
!
exist
{
f
.
xmlAttr
[
path
]
=
append
(
f
.
xmlAttr
[
path
],
ns
)
if
!
mc
{
f
.
xmlAttr
[
path
]
=
append
(
f
.
xmlAttr
[
path
],
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"mc"
,
Space
:
"xmlns"
},
Value
:
SourceRelationshipCompatibility
,
})
f
.
xmlAttr
[
path
]
=
append
(
f
.
xmlAttr
[
path
],
SourceRelationshipCompatibility
)
}
if
!
ignore
{
f
.
xmlAttr
[
path
]
=
append
(
f
.
xmlAttr
[
path
],
xml
.
Attr
{
...
...
table.go
浏览文件 @
ca43c651
...
...
@@ -287,14 +287,8 @@ func (f *File) AutoFilter(sheet, hcell, vcell, format string) error {
}
formatSet
,
_
:=
parseAutoFilterSet
(
format
)
var
cellStart
,
cellEnd
string
if
cellStart
,
err
=
CoordinatesToCellName
(
hcol
,
hrow
);
err
!=
nil
{
return
err
}
if
cellEnd
,
err
=
CoordinatesToCellName
(
vcol
,
vrow
);
err
!=
nil
{
return
err
}
cellStart
,
_
:=
CoordinatesToCellName
(
hcol
,
hrow
)
cellEnd
,
_
:=
CoordinatesToCellName
(
vcol
,
vrow
)
ref
,
filterDB
:=
cellStart
+
":"
+
cellEnd
,
"_xlnm._FilterDatabase"
wb
:=
f
.
workbookReader
()
sheetID
:=
f
.
GetSheetIndex
(
sheet
)
...
...
table_test.go
浏览文件 @
ca43c651
...
...
@@ -29,6 +29,8 @@ func TestAddTable(t *testing.T) {
t
.
FailNow
()
}
// Test add table in not exist worksheet.
assert
.
EqualError
(
t
,
f
.
AddTable
(
"SheetN"
,
"B26"
,
"A21"
,
`{}`
),
"sheet SheetN is not exist"
)
// Test add table with illegal formatset.
assert
.
EqualError
(
t
,
f
.
AddTable
(
"Sheet1"
,
"B26"
,
"A21"
,
`{x}`
),
"invalid character 'x' looking for beginning of object key string"
)
// Test add table with illegal cell coordinates.
...
...
@@ -100,6 +102,10 @@ func TestAutoFilterError(t *testing.T) {
})
}
assert
.
EqualError
(
t
,
f
.
autoFilter
(
"SheetN"
,
"A1"
,
1
,
1
,
&
formatAutoFilter
{
Column
:
"A"
,
Expression
:
""
,
}),
"sheet SheetN is not exist"
)
assert
.
EqualError
(
t
,
f
.
autoFilter
(
"Sheet1"
,
"A1"
,
1
,
1
,
&
formatAutoFilter
{
Column
:
"-"
,
Expression
:
"-"
,
...
...
xmlDrawing.go
浏览文件 @
ca43c651
...
...
@@ -15,9 +15,10 @@ import "encoding/xml"
// Source relationship and namespace.
var
(
SourceRelationship
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"r"
,
Space
:
"xmlns"
},
Value
:
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
}
NameSpaceSpreadSheet
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"xmlns"
},
Value
:
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
}
NameSpaceSpreadSheetX14
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"x14"
,
Space
:
"xmlns"
},
Value
:
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
}
SourceRelationship
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"r"
,
Space
:
"xmlns"
},
Value
:
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
}
SourceRelationshipCompatibility
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"mc"
,
Space
:
"xmlns"
},
Value
:
"http://schemas.openxmlformats.org/markup-compatibility/2006"
}
NameSpaceSpreadSheet
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"xmlns"
},
Value
:
"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
}
NameSpaceSpreadSheetX14
=
xml
.
Attr
{
Name
:
xml
.
Name
{
Local
:
"x14"
,
Space
:
"xmlns"
},
Value
:
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
}
)
// Source relationship and namespace.
...
...
@@ -39,7 +40,6 @@ const (
SourceRelationshipChart201506
=
"http://schemas.microsoft.com/office/drawing/2015/06/chart"
SourceRelationshipChart20070802
=
"http://schemas.microsoft.com/office/drawing/2007/8/2/chart"
SourceRelationshipChart2014
=
"http://schemas.microsoft.com/office/drawing/2014/chart"
SourceRelationshipCompatibility
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
NameSpaceDrawingML
=
"http://schemas.openxmlformats.org/drawingml/2006/main"
NameSpaceDrawingMLChart
=
"http://schemas.openxmlformats.org/drawingml/2006/chart"
NameSpaceDrawingMLSpreadSheet
=
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录