Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
a00ba75f
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,发现更多精彩内容 >>
未验证
提交
a00ba75f
编写于
9月 30, 2019
作者:
xurime
提交者:
GitHub
9月 30, 2019
浏览文件
操作
浏览文件
下载
差异文件
Fix #493 Merge pull request #495 from jaby/493-ShowZeros
Add missing ShowZeros SheetViewOption implementation
上级
eb520ae2
babfeb6b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
3 deletion
+29
-3
sheetview.go
sheetview.go
+14
-2
sheetview_test.go
sheetview_test.go
+14
-0
xmlWorksheet.go
xmlWorksheet.go
+1
-1
未找到文件。
sheetview.go
浏览文件 @
a00ba75f
...
...
@@ -51,14 +51,18 @@ type (
// visible cell Location of the top left visible cell in the bottom right
// pane (when in Left-to-Right mode).
TopLeftCell
string
// ShowZeros is a SheetViewOption. It specifies a flag indicating
// whether to "show a zero in cells that have zero value".
// When using a formula to reference another cell which is empty, the referenced value becomes 0
// when the flag is true. (Default setting is true.)
ShowZeros
bool
/* TODO
// ShowWhiteSpace is a SheetViewOption. It specifies a flag indicating
// whether page layout view shall display margins. False means do not display
// left, right, top (header), and bottom (footer) margins (even when there is
// data in the header or footer).
ShowWhiteSpace bool
// ShowZeros is a SheetViewOption.
ShowZeros bool
// WindowProtection is a SheetViewOption.
WindowProtection bool
*/
...
...
@@ -106,6 +110,14 @@ func (o *ShowGridLines) getSheetViewOption(view *xlsxSheetView) {
*
o
=
ShowGridLines
(
defaultTrue
(
view
.
ShowGridLines
))
// Excel default: true
}
func
(
o
ShowZeros
)
setSheetViewOption
(
view
*
xlsxSheetView
)
{
view
.
ShowZeros
=
boolPtr
(
bool
(
o
))
}
func
(
o
*
ShowZeros
)
getSheetViewOption
(
view
*
xlsxSheetView
)
{
*
o
=
ShowZeros
(
defaultTrue
(
view
.
ShowZeros
))
// Excel default: true
}
func
(
o
ShowRowColHeaders
)
setSheetViewOption
(
view
*
xlsxSheetView
)
{
view
.
ShowRowColHeaders
=
boolPtr
(
bool
(
o
))
}
...
...
sheetview_test.go
浏览文件 @
a00ba75f
...
...
@@ -95,6 +95,7 @@ func ExampleFile_GetSheetViewOptions() {
rightToLeft
excelize
.
RightToLeft
showFormulas
excelize
.
ShowFormulas
showGridLines
excelize
.
ShowGridLines
showZeros
excelize
.
ShowZeros
showRowColHeaders
excelize
.
ShowRowColHeaders
zoomScale
excelize
.
ZoomScale
topLeftCell
excelize
.
TopLeftCell
...
...
@@ -105,6 +106,7 @@ func ExampleFile_GetSheetViewOptions() {
&
rightToLeft
,
&
showFormulas
,
&
showGridLines
,
&
showZeros
,
&
showRowColHeaders
,
&
zoomScale
,
&
topLeftCell
,
...
...
@@ -117,6 +119,7 @@ func ExampleFile_GetSheetViewOptions() {
fmt
.
Println
(
"- rightToLeft:"
,
rightToLeft
)
fmt
.
Println
(
"- showFormulas:"
,
showFormulas
)
fmt
.
Println
(
"- showGridLines:"
,
showGridLines
)
fmt
.
Println
(
"- showZeros:"
,
showZeros
)
fmt
.
Println
(
"- showRowColHeaders:"
,
showRowColHeaders
)
fmt
.
Println
(
"- zoomScale:"
,
zoomScale
)
fmt
.
Println
(
"- topLeftCell:"
,
`"`
+
topLeftCell
+
`"`
)
...
...
@@ -137,8 +140,17 @@ func ExampleFile_GetSheetViewOptions() {
panic
(
err
)
}
if
err
:=
f
.
SetSheetViewOptions
(
sheet
,
0
,
excelize
.
ShowZeros
(
false
));
err
!=
nil
{
panic
(
err
)
}
if
err
:=
f
.
GetSheetViewOptions
(
sheet
,
0
,
&
showZeros
);
err
!=
nil
{
panic
(
err
)
}
fmt
.
Println
(
"After change:"
)
fmt
.
Println
(
"- showGridLines:"
,
showGridLines
)
fmt
.
Println
(
"- showZeros:"
,
showZeros
)
fmt
.
Println
(
"- topLeftCell:"
,
topLeftCell
)
// Output:
...
...
@@ -147,11 +159,13 @@ func ExampleFile_GetSheetViewOptions() {
// - rightToLeft: false
// - showFormulas: false
// - showGridLines: true
// - showZeros: true
// - showRowColHeaders: true
// - zoomScale: 0
// - topLeftCell: ""
// After change:
// - showGridLines: false
// - showZeros: false
// - topLeftCell: B2
}
...
...
xmlWorksheet.go
浏览文件 @
a00ba75f
...
...
@@ -167,7 +167,7 @@ type xlsxSheetView struct {
ShowFormulas
bool
`xml:"showFormulas,attr,omitempty"`
ShowGridLines
*
bool
`xml:"showGridLines,attr"`
ShowRowColHeaders
*
bool
`xml:"showRowColHeaders,attr"`
ShowZeros
bool
`xml:"showZeros,attr,omitempty"`
ShowZeros
*
bool
`xml:"showZeros,attr,omitempty"`
RightToLeft
bool
`xml:"rightToLeft,attr,omitempty"`
TabSelected
bool
`xml:"tabSelected,attr,omitempty"`
ShowWhiteSpace
*
bool
`xml:"showWhiteSpace,attr"`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录