Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
843bd24e
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,发现更多精彩内容 >>
提交
843bd24e
编写于
8月 06, 2020
作者:
xurime
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
This closes #677 and closes #679, fix panic when enabling compiler inline flags
上级
fcbc7e3f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
12 deletion
+5
-12
lib.go
lib.go
+2
-9
sheet.go
sheet.go
+2
-2
stream.go
stream.go
+1
-1
未找到文件。
lib.go
浏览文件 @
843bd24e
...
...
@@ -20,7 +20,6 @@ import (
"io"
"strconv"
"strings"
"unsafe"
)
// ReadZipReader can be used to read the spreadsheet in memory without touching the
...
...
@@ -251,17 +250,11 @@ func namespaceStrictToTransitional(content []byte) []byte {
StrictNameSpaceSpreadSheet
:
NameSpaceSpreadSheet
.
Value
,
}
for
s
,
n
:=
range
namespaceTranslationDic
{
content
=
bytesReplace
(
content
,
stringToBytes
(
s
),
stringToBytes
(
n
),
-
1
)
content
=
bytesReplace
(
content
,
[]
byte
(
s
),
[]
byte
(
n
),
-
1
)
}
return
content
}
// stringToBytes cast a string to bytes pointer and assign the value of this
// pointer.
func
stringToBytes
(
s
string
)
[]
byte
{
return
*
(
*
[]
byte
)(
unsafe
.
Pointer
(
&
s
))
}
// bytesReplace replace old bytes with given new.
func
bytesReplace
(
s
,
old
,
new
[]
byte
,
n
int
)
[]
byte
{
if
n
==
0
{
...
...
@@ -366,7 +359,7 @@ func getXMLNamespace(space string, attr []xml.Attr) string {
// replaceNameSpaceBytes provides a function to replace the XML root element
// attribute by the given component part path and XML content.
func
(
f
*
File
)
replaceNameSpaceBytes
(
path
string
,
contentMarshal
[]
byte
)
[]
byte
{
var
oldXmlns
=
stringToBytes
(
`xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
)
var
oldXmlns
=
[]
byte
(
`xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
)
var
newXmlns
=
[]
byte
(
templateNamespaceIDMap
)
if
attr
,
ok
:=
f
.
xmlAttr
[
path
];
ok
{
newXmlns
=
[]
byte
(
genXMLNamespace
(
attr
))
...
...
sheet.go
浏览文件 @
843bd24e
...
...
@@ -213,8 +213,8 @@ func (f *File) setAppXML() {
// strict requirements about the structure of the input XML. This function is
// a horrible hack to fix that after the XML marshalling is completed.
func
replaceRelationshipsBytes
(
content
[]
byte
)
[]
byte
{
oldXmlns
:=
stringToBytes
(
`xmlns:relationships="http://schemas.openxmlformats.org/officeDocument/2006/relationships" relationships`
)
newXmlns
:=
stringToBytes
(
"r"
)
oldXmlns
:=
[]
byte
(
`xmlns:relationships="http://schemas.openxmlformats.org/officeDocument/2006/relationships" relationships`
)
newXmlns
:=
[]
byte
(
"r"
)
return
bytesReplace
(
content
,
oldXmlns
,
newXmlns
,
-
1
)
}
...
...
stream.go
浏览文件 @
843bd24e
...
...
@@ -367,7 +367,7 @@ func writeCell(buf *bufferedWriter, c xlsxC) {
buf
.
WriteString
(
`>`
)
if
c
.
V
!=
""
{
buf
.
WriteString
(
`<v>`
)
xml
.
EscapeText
(
buf
,
stringToBytes
(
c
.
V
))
xml
.
EscapeText
(
buf
,
[]
byte
(
c
.
V
))
buf
.
WriteString
(
`</v>`
)
}
buf
.
WriteString
(
`</c>`
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录