Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
b45c4b09
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,发现更多精彩内容 >>
提交
b45c4b09
编写于
4月 21, 2019
作者:
xurime
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a check for maximum limit hyperlinks in a worksheet
typo fixed
上级
0660f30c
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
472 addition
and
454 deletion
+472
-454
cell.go
cell.go
+10
-4
chart.go
chart.go
+9
-5
comment.go
comment.go
+1
-1
excelize_test.go
excelize_test.go
+451
-443
shape.go
shape.go
+1
-1
未找到文件。
cell.go
浏览文件 @
b45c4b09
...
...
@@ -336,7 +336,8 @@ func (f *File) GetCellHyperLink(sheet, axis string) (bool, string, error) {
// SetCellHyperLink provides a function to set cell hyperlink by given
// worksheet name and link URL address. LinkType defines two types of
// hyperlink "External" for web site or "Location" for moving to one of cell
// in this workbook. The below is example for external link.
// in this workbook. Maximum limit hyperlinks in a worksheet is 65530. The
// below is example for external link.
//
// err := f.SetCellHyperLink("Sheet1", "A3", "https://github.com/360EntSecGroup-Skylar/excelize", "External")
// // Set underline and font color style for the cell.
...
...
@@ -364,6 +365,14 @@ func (f *File) SetCellHyperLink(sheet, axis, link, linkType string) error {
var
linkData
xlsxHyperlink
if
xlsx
.
Hyperlinks
==
nil
{
xlsx
.
Hyperlinks
=
new
(
xlsxHyperlinks
)
}
if
len
(
xlsx
.
Hyperlinks
.
Hyperlink
)
>
65529
{
return
errors
.
New
(
"over maximum limit hyperlinks in a worksheet"
)
}
switch
linkType
{
case
"External"
:
linkData
=
xlsxHyperlink
{
...
...
@@ -380,9 +389,6 @@ func (f *File) SetCellHyperLink(sheet, axis, link, linkType string) error {
return
fmt
.
Errorf
(
"invalid link type %q"
,
linkType
)
}
if
xlsx
.
Hyperlinks
==
nil
{
xlsx
.
Hyperlinks
=
new
(
xlsxHyperlinks
)
}
xlsx
.
Hyperlinks
.
Hyperlink
=
append
(
xlsx
.
Hyperlinks
.
Hyperlink
,
linkData
)
return
nil
}
...
...
chart.go
浏览文件 @
b45c4b09
...
...
@@ -314,16 +314,20 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
// func main() {
// categories := map[string]string{"A2": "Small", "A3": "Normal", "A4": "Large", "B1": "Apple", "C1": "Orange", "D1": "Pear"}
// values := map[string]int{"B2": 2, "C2": 3, "D2": 3, "B3": 5, "C3": 2, "D3": 4, "B4": 6, "C4": 7, "D4": 8}
//
xlsx
:= excelize.NewFile()
//
f
:= excelize.NewFile()
// for k, v := range categories {
//
xlsx
.SetCellValue("Sheet1", k, v)
//
f
.SetCellValue("Sheet1", k, v)
// }
// for k, v := range values {
// xlsx.SetCellValue("Sheet1", k, v)
// f.SetCellValue("Sheet1", k, v)
// }
// err := f.AddChart("Sheet1", "E1", `{"type":"col3DClustered","dimension":{"width":640,"height":480},"series":[{"name":"Sheet1!$A$2","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$2:$D$2"},{"name":"Sheet1!$A$3","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$3:$D$3"},{"name":"Sheet1!$A$4","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$4:$D$4"}],"format":{"x_scale":1.0,"y_scale":1.0,"x_offset":15,"y_offset":10,"print_obj":true,"lock_aspect_ratio":false,"locked":false},"legend":{"position":"bottom","show_legend_key":false},"title":{"name":"Fruit 3D Clustered Column Chart"},"plotarea":{"show_bubble_size":true,"show_cat_name":false,"show_leader_lines":false,"show_percent":true,"show_series_name":true,"show_val":true},"show_blanks_as":"zero","x_axis":{"reverse_order":true},"y_axis":{"maximum":7.5,"minimum":0.5}}`)
// if err != nil {
// fmt.Println(err)
// return
// }
// xlsx.AddChart("Sheet1", "E1", `{"type":"col3DClustered","dimension":{"width":640,"height":480},"series":[{"name":"Sheet1!$A$2","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$2:$D$2"},{"name":"Sheet1!$A$3","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$3:$D$3"},{"name":"Sheet1!$A$4","categories":"Sheet1!$B$1:$D$1","values":"Sheet1!$B$4:$D$4"}],"format":{"x_scale":1.0,"y_scale":1.0,"x_offset":15,"y_offset":10,"print_obj":true,"lock_aspect_ratio":false,"locked":false},"legend":{"position":"bottom","show_legend_key":false},"title":{"name":"Fruit 3D Clustered Column Chart"},"plotarea":{"show_bubble_size":true,"show_cat_name":false,"show_leader_lines":false,"show_percent":true,"show_series_name":true,"show_val":true},"show_blanks_as":"zero","x_axis":{"reverse_order":true},"y_axis":{"maximum":7.5,"minimum":0.5}}`)
// // Save xlsx file by the given path.
// err
:
= xlsx.SaveAs("./Book1.xlsx")
// err = xlsx.SaveAs("./Book1.xlsx")
// if err != nil {
// fmt.Println(err)
// }
...
...
comment.go
浏览文件 @
b45c4b09
...
...
@@ -72,7 +72,7 @@ func (f *File) getSheetComments(sheetID int) string {
// author length is 255 and the max text length is 32512. For example, add a
// comment in Sheet1!$A$30:
//
// err :=
xlsx
.AddComment("Sheet1", "A30", `{"author":"Excelize: ","text":"This is a comment."}`)
// err :=
f
.AddComment("Sheet1", "A30", `{"author":"Excelize: ","text":"This is a comment."}`)
//
func
(
f
*
File
)
AddComment
(
sheet
,
cell
,
format
string
)
error
{
formatSet
,
err
:=
parseFormatCommentsSet
(
format
)
...
...
excelize_test.go
浏览文件 @
b45c4b09
此差异已折叠。
点击以展开。
shape.go
浏览文件 @
b45c4b09
...
...
@@ -40,7 +40,7 @@ func parseFormatShapeSet(formatSet string) (*formatShape, error) {
// print settings) and properties set. For example, add text box (rect shape)
// in Sheet1:
//
// f.AddShape("Sheet1", "G6", `{"type":"rect","color":{"line":"#4286F4","fill":"#8eb9ff"},"paragraph":[{"text":"Rectangle Shape","font":{"bold":true,"italic":true,"family":"Berlin Sans FB Demi","size":36,"color":"#777777","underline":"sng"}}],"width":180,"height": 90}`)
//
err :=
f.AddShape("Sheet1", "G6", `{"type":"rect","color":{"line":"#4286F4","fill":"#8eb9ff"},"paragraph":[{"text":"Rectangle Shape","font":{"bold":true,"italic":true,"family":"Berlin Sans FB Demi","size":36,"color":"#777777","underline":"sng"}}],"width":180,"height": 90}`)
//
// The following shows the type of shape supported by excelize:
//
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录