Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
此号慢热型
excelize
提交
192af02a
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,发现更多精彩内容 >>
提交
192af02a
编写于
9月 02, 2016
作者:
xurime
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Format code with golint rules
上级
0a0a36ba
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
60 addition
and
61 deletion
+60
-61
cell.go
cell.go
+3
-3
excelize.go
excelize.go
+6
-5
file.go
file.go
+10
-13
lib.go
lib.go
+4
-4
sheet.go
sheet.go
+20
-20
templates.go
templates.go
+10
-9
xmlWorkbook.go
xmlWorkbook.go
+4
-4
xmlWorksheet.go
xmlWorksheet.go
+3
-3
未找到文件。
cell.go
浏览文件 @
192af02a
...
...
@@ -6,14 +6,14 @@ import (
"strings"
)
// Get value from cell by given sheet index and axis in XLSX file
// Get
CellValue provide function get
value from cell by given sheet index and axis in XLSX file
func
GetCellValue
(
file
[]
FileList
,
sheet
string
,
axis
string
)
string
{
axis
=
strings
.
ToUpper
(
axis
)
var
xlsx
xlsxWorksheet
row
:=
getRowIndex
(
axis
)
xAxis
:=
row
-
1
name
:=
`xl/worksheets/`
+
strings
.
ToLower
(
sheet
)
+
`.xml`
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
name
)),
&
xlsx
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
name
)),
&
xlsx
)
rows
:=
len
(
xlsx
.
SheetData
.
Row
)
if
rows
<=
xAxis
{
return
``
...
...
@@ -26,7 +26,7 @@ func GetCellValue(file []FileList, sheet string, axis string) string {
shardStrings
:=
xlsxSST
{}
xlsxSI
:=
0
xlsxSI
,
_
=
strconv
.
Atoi
(
v
.
V
)
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
`xl/sharedStrings.xml`
)),
&
shardStrings
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
`xl/sharedStrings.xml`
)),
&
shardStrings
)
return
shardStrings
.
SI
[
xlsxSI
]
.
T
case
"str"
:
return
v
.
V
...
...
excelize.go
浏览文件 @
192af02a
...
...
@@ -8,12 +8,13 @@ import (
"strings"
)
// FileList define a populated xlsx.File struct.
type
FileList
struct
{
Key
string
Value
string
}
// OpenFile
()
take the name of an XLSX file and returns a populated
// OpenFile take the name of an XLSX file and returns a populated
// xlsx.File struct for it.
func
OpenFile
(
filename
string
)
(
file
[]
FileList
,
err
error
)
{
var
f
*
zip
.
ReadCloser
...
...
@@ -25,7 +26,7 @@ func OpenFile(filename string) (file []FileList, err error) {
return
}
// Set int type value of a cell
// Set
CellInt provide function to set
int type value of a cell
func
SetCellInt
(
file
[]
FileList
,
sheet
string
,
axis
string
,
value
int
)
[]
FileList
{
axis
=
strings
.
ToUpper
(
axis
)
var
xlsx
xlsxWorksheet
...
...
@@ -35,7 +36,7 @@ func SetCellInt(file []FileList, sheet string, axis string, value int) []FileLis
yAxis
:=
titleToNumber
(
col
)
name
:=
`xl/worksheets/`
+
strings
.
ToLower
(
sheet
)
+
`.xml`
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
name
)),
&
xlsx
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
name
)),
&
xlsx
)
rows
:=
xAxis
+
1
cell
:=
yAxis
+
1
...
...
@@ -56,7 +57,7 @@ func SetCellInt(file []FileList, sheet string, axis string, value int) []FileLis
return
file
}
// Set string type value of a cell
// Set
CellStr provide function to set
string type value of a cell
func
SetCellStr
(
file
[]
FileList
,
sheet
string
,
axis
string
,
value
string
)
[]
FileList
{
axis
=
strings
.
ToUpper
(
axis
)
var
xlsx
xlsxWorksheet
...
...
@@ -66,7 +67,7 @@ func SetCellStr(file []FileList, sheet string, axis string, value string) []File
yAxis
:=
titleToNumber
(
col
)
name
:=
`xl/worksheets/`
+
strings
.
ToLower
(
sheet
)
+
`.xml`
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
name
)),
&
xlsx
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
name
)),
&
xlsx
)
rows
:=
xAxis
+
1
cell
:=
yAxis
+
1
...
...
file.go
浏览文件 @
192af02a
...
...
@@ -6,23 +6,20 @@ import (
"os"
)
// Create a new xlsx file
//
// CreateFile provide function to create new file by default template
// For example:
//
// xlsx := CreateFile()
//
func
CreateFile
()
[]
FileList
{
var
file
[]
FileList
file
=
saveFileList
(
file
,
`_rels/.rels`
,
TEMPLATE_RELS
)
file
=
saveFileList
(
file
,
`docProps/app.xml`
,
TEMPLATE_DOCPROPS_APP
)
file
=
saveFileList
(
file
,
`docProps/core.xml`
,
TEMPLATE_DOCPROPS_CORE
)
file
=
saveFileList
(
file
,
`xl/_rels/workbook.xml.rels`
,
TEMPLATE_WORKBOOK_RELS
)
file
=
saveFileList
(
file
,
`xl/theme/theme1.xml`
,
TEMPLATE_THEME
)
file
=
saveFileList
(
file
,
`xl/worksheets/sheet1.xml`
,
TEMPLATE_SHEET
)
file
=
saveFileList
(
file
,
`xl/styles.xml`
,
TEMPLATE_STYLES
)
file
=
saveFileList
(
file
,
`xl/workbook.xml`
,
TEMPLATE_WORKBOOK
)
file
=
saveFileList
(
file
,
`[Content_Types].xml`
,
TEMPLATE_CONTENT_TYPES
)
file
=
saveFileList
(
file
,
`_rels/.rels`
,
templateRels
)
file
=
saveFileList
(
file
,
`docProps/app.xml`
,
templateDocpropsApp
)
file
=
saveFileList
(
file
,
`docProps/core.xml`
,
templateDocpropsCore
)
file
=
saveFileList
(
file
,
`xl/_rels/workbook.xml.rels`
,
templateWorkbookRels
)
file
=
saveFileList
(
file
,
`xl/theme/theme1.xml`
,
templateTheme
)
file
=
saveFileList
(
file
,
`xl/worksheets/sheet1.xml`
,
templateSheet
)
file
=
saveFileList
(
file
,
`xl/styles.xml`
,
templateStyles
)
file
=
saveFileList
(
file
,
`xl/workbook.xml`
,
templateWorkbook
)
file
=
saveFileList
(
file
,
`[Content_Types].xml`
,
templateContentTypes
)
return
file
}
...
...
lib.go
浏览文件 @
192af02a
...
...
@@ -11,15 +11,15 @@ import (
"strings"
)
// ReadZip
()
takes a pointer to a zip.ReadCloser and returns a
// xlsx.File struct populated with its contents.
In most cases
// ReadZip takes a pointer to a zip.ReadCloser and returns a
// xlsx.File struct populated with its contents. In most cases
// ReadZip is not used directly, but is called internally by OpenFile.
func
ReadZip
(
f
*
zip
.
ReadCloser
)
([]
FileList
,
error
)
{
defer
f
.
Close
()
return
ReadZipReader
(
&
f
.
Reader
)
}
// ReadZipReader
()
can be used to read an XLSX in memory without
// ReadZipReader can be used to read an XLSX in memory without
// touching the filesystem.
func
ReadZipReader
(
r
*
zip
.
Reader
)
([]
FileList
,
error
)
{
var
fileList
[]
FileList
...
...
@@ -34,7 +34,7 @@ func ReadZipReader(r *zip.Reader) ([]FileList, error) {
}
// Read XML content as string and replace drawing property in XML namespace of sheet
func
readX
ml
(
files
[]
FileList
,
name
string
)
string
{
func
readX
ML
(
files
[]
FileList
,
name
string
)
string
{
for
_
,
file
:=
range
files
{
if
file
.
Key
==
name
{
return
strings
.
Replace
(
file
.
Value
,
"<drawing r:id="
,
"<drawing rid="
,
-
1
)
...
...
sheet.go
浏览文件 @
192af02a
...
...
@@ -7,12 +7,12 @@ import (
"strings"
)
//
Create a new sheet by given index, when creating a new XLSX file,
//
the default sheet will be create, when you create a new file,
you
// need to ensure that the index is continuous.
//
NewSheet provice function to greate a new sheet by given index, when
//
creating a new XLSX file, the default sheet will be create, when
you
//
create a new file, you
need to ensure that the index is continuous.
func
NewSheet
(
file
[]
FileList
,
index
int
,
name
string
)
[]
FileList
{
// Update docProps/app.xml
file
=
setAppX
ml
(
file
)
file
=
setAppX
ML
(
file
)
// Update [Content_Types].xml
file
=
setContentTypes
(
file
,
index
)
// Create new sheet /xl/worksheets/sheet%d.xml
...
...
@@ -27,7 +27,7 @@ func NewSheet(file []FileList, index int, name string) []FileList {
// Read and update property of contents type of XLSX
func
setContentTypes
(
file
[]
FileList
,
index
int
)
[]
FileList
{
var
content
xlsxTypes
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
`[Content_Types].xml`
)),
&
content
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
`[Content_Types].xml`
)),
&
content
)
content
.
Overrides
=
append
(
content
.
Overrides
,
xlsxOverride
{
PartName
:
`/xl/worksheets/sheet`
+
strconv
.
Itoa
(
index
)
+
`.xml`
,
ContentType
:
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
,
...
...
@@ -44,7 +44,7 @@ func setSheet(file []FileList, index int) []FileList {
var
xlsx
xlsxWorksheet
xlsx
.
Dimension
.
Ref
=
"A1"
xlsx
.
SheetViews
.
SheetView
=
append
(
xlsx
.
SheetViews
.
SheetView
,
xlsxSheetView
{
WorkbookViewI
d
:
0
,
WorkbookViewI
D
:
0
,
})
output
,
err
:=
xml
.
MarshalIndent
(
xlsx
,
""
,
""
)
if
err
!=
nil
{
...
...
@@ -57,14 +57,14 @@ func setSheet(file []FileList, index int) []FileList {
// Update workbook property of XLSX
func
setWorkbook
(
file
[]
FileList
,
index
int
,
name
string
)
[]
FileList
{
var
content
xlsxWorkbook
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
`xl/workbook.xml`
)),
&
content
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
`xl/workbook.xml`
)),
&
content
)
rels
:=
readXlsxWorkbookRels
(
file
)
rI
d
:=
len
(
rels
.
Relationships
)
rI
D
:=
len
(
rels
.
Relationships
)
content
.
Sheets
.
Sheet
=
append
(
content
.
Sheets
.
Sheet
,
xlsxSheet
{
Name
:
name
,
SheetI
d
:
strconv
.
Itoa
(
index
),
I
d
:
"rId"
+
strconv
.
Itoa
(
rId
),
SheetI
D
:
strconv
.
Itoa
(
index
),
I
D
:
"rId"
+
strconv
.
Itoa
(
rID
),
})
output
,
err
:=
xml
.
MarshalIndent
(
content
,
""
,
""
)
if
err
!=
nil
{
...
...
@@ -76,16 +76,16 @@ func setWorkbook(file []FileList, index int, name string) []FileList {
// Read and unmarshal workbook relationships of XLSX
func
readXlsxWorkbookRels
(
file
[]
FileList
)
xlsxWorkbookRels
{
var
content
xlsxWorkbookRels
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
`xl/_rels/workbook.xml.rels`
)),
&
content
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
`xl/_rels/workbook.xml.rels`
)),
&
content
)
return
content
}
// Update workbook relationships property of XLSX
func
addXlsxWorkbookRels
(
file
[]
FileList
,
sheet
int
)
[]
FileList
{
content
:=
readXlsxWorkbookRels
(
file
)
rI
d
:=
len
(
content
.
Relationships
)
+
1
rI
D
:=
len
(
content
.
Relationships
)
+
1
content
.
Relationships
=
append
(
content
.
Relationships
,
xlsxWorkbookRelation
{
I
d
:
"rId"
+
strconv
.
Itoa
(
rId
),
I
D
:
"rId"
+
strconv
.
Itoa
(
rID
),
Target
:
`worksheets/sheet`
+
strconv
.
Itoa
(
sheet
)
+
`.xml`
,
Type
:
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
,
})
...
...
@@ -97,8 +97,8 @@ func addXlsxWorkbookRels(file []FileList, sheet int) []FileList {
}
// Update docProps/app.xml file of XML
func
setAppX
ml
(
file
[]
FileList
)
[]
FileList
{
return
saveFileList
(
file
,
`docProps/app.xml`
,
TEMPLATE_DOCPROPS_APP
)
func
setAppX
ML
(
file
[]
FileList
)
[]
FileList
{
return
saveFileList
(
file
,
`docProps/app.xml`
,
templateDocpropsApp
)
}
// Some tools that read XLSX files have very strict requirements about
...
...
@@ -125,14 +125,14 @@ func replaceRelationshipsID(workbookMarshal string) string {
return
strings
.
Replace
(
rids
,
`<drawing rid="`
,
`<drawing r:id="`
,
-
1
)
}
// Set default active sheet of XLSX by given index
// Set
ActiveSheet provide function to set
default active sheet of XLSX by given index
func
SetActiveSheet
(
file
[]
FileList
,
index
int
)
[]
FileList
{
var
content
xlsxWorkbook
if
index
<
1
{
index
=
1
}
index
-=
1
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
`xl/workbook.xml`
)),
&
content
)
index
--
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
`xl/workbook.xml`
)),
&
content
)
if
len
(
content
.
BookViews
.
WorkBookView
)
>
0
{
content
.
BookViews
.
WorkBookView
[
0
]
.
ActiveTab
=
index
}
else
{
...
...
@@ -146,12 +146,12 @@ func SetActiveSheet(file []FileList, index int) []FileList {
fmt
.
Println
(
err
)
}
file
=
saveFileList
(
file
,
`xl/workbook.xml`
,
workBookCompatibility
(
replaceRelationshipsNameSpace
(
string
(
output
))))
index
+=
1
index
++
for
i
:=
0
;
i
<
sheets
;
i
++
{
xlsx
:=
xlsxWorksheet
{}
sheetIndex
:=
i
+
1
path
:=
`xl/worksheets/sheet`
+
strconv
.
Itoa
(
sheetIndex
)
+
`.xml`
xml
.
Unmarshal
([]
byte
(
readX
ml
(
file
,
path
)),
&
xlsx
)
xml
.
Unmarshal
([]
byte
(
readX
ML
(
file
,
path
)),
&
xlsx
)
if
index
==
sheetIndex
{
if
len
(
xlsx
.
SheetViews
.
SheetView
)
>
0
{
xlsx
.
SheetViews
.
SheetView
[
0
]
.
TabSelected
=
true
...
...
templates.go
浏览文件 @
192af02a
...
...
@@ -3,14 +3,15 @@
package
excelize
// XMLHeader define an XML declaration can also contain a standalone declaration
const
XMLHeader
=
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?>
\n
"
const
TEMPLATE_DOCPROPS_APP
=
`<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
const
templateDocpropsApp
=
`<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<TotalTime>0</TotalTime>
<Application>Go XLSX</Application>
</Properties>`
const
TEMPLATE_CONTENT_TYPES
=
`<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
const
templateContentTypes
=
`<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
...
...
@@ -21,20 +22,20 @@ const TEMPLATE_CONTENT_TYPES = `<Types xmlns="http://schemas.openxmlformats.org/
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
</Types>`
const
TEMPLATE_WORKBOOK
=
`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4505" /><workbookPr filterPrivacy="1" defaultThemeVersion="124226" /><bookViews><workbookView xWindow="240" yWindow="105" windowWidth="14805" windowHeight="8010" /></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1" /></sheets><calcPr calcId="122211" fullCalcOnLoad="1" /></workbook>
const
templateWorkbook
=
`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4505" /><workbookPr filterPrivacy="1" defaultThemeVersion="124226" /><bookViews><workbookView xWindow="240" yWindow="105" windowWidth="14805" windowHeight="8010" /></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1" /></sheets><calcPr calcId="122211" fullCalcOnLoad="1" /></workbook>
`
const
TEMPLATE_STYLES
=
`<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><color theme="1"/><name val="宋体"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleMedium9"/></styleSheet>
const
templateStyles
=
`<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><color theme="1"/><name val="宋体"/><family val="2"/><scheme val="minor"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles><dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleMedium9"/></styleSheet>
`
const
TEMPLATE_SHEET
=
`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="A1"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>
const
templateSheet
=
`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="A1"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData/><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>
`
const
TEMPLATE_WORKBOOK_RELS
=
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/></Relationships>`
const
templateWorkbookRels
=
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/></Relationships>`
const
TEMPLATE_DOCPROPS_CORE
=
`<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>xuri</dc:creator><dcterms:created xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:modified></cp:coreProperties>`
const
templateDocpropsCore
=
`<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>xuri</dc:creator><dcterms:created xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2006-09-16T00:00:00Z</dcterms:modified></cp:coreProperties>`
const
TEMPLATE_RELS
=
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`
const
templateRels
=
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`
const
TEMPLATE_THEME
=
`<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Cambria"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/>
const
templateTheme
=
`<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="1F497D"/></a:dk2><a:lt2><a:srgbClr val="EEECE1"/></a:lt2><a:accent1><a:srgbClr val="4F81BD"/></a:accent1><a:accent2><a:srgbClr val="C0504D"/></a:accent2><a:accent3><a:srgbClr val="9BBB59"/></a:accent3><a:accent4><a:srgbClr val="8064A2"/></a:accent4><a:accent5><a:srgbClr val="4BACC6"/></a:accent5><a:accent6><a:srgbClr val="F79646"/></a:accent6><a:hlink><a:srgbClr val="0000FF"/></a:hlink><a:folHlink><a:srgbClr val="800080"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Cambria"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/>
</a:majorFont><a:minorFont><a:latin typeface="Calibri"/><a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="MS Pゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="宋体"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Tahoma"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/>
</a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:shade val="51000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="80000"><a:schemeClr val="phClr"><a:shade val="93000"/><a:satMod val="130000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="94000"/><a:satMod val="135000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>`
xmlWorkbook.go
浏览文件 @
192af02a
...
...
@@ -23,7 +23,7 @@ type xlsxWorkbookRels struct {
// xmlxWorkbookRelation maps sheet id and xl/worksheets/sheet%d.xml
type
xlsxWorkbookRelation
struct
{
I
d
string
`xml:"
,attr"`
I
D
string
`xml:"Id
,attr"`
Target
string
`xml:",attr"`
Type
string
`xml:",attr"`
}
...
...
@@ -118,8 +118,8 @@ type xlsxSheets struct {
// as I need.
type
xlsxSheet
struct
{
Name
string
`xml:"name,attr,omitempty"`
SheetI
d
string
`xml:"sheetId,attr,omitempty"`
I
d
string
`xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
SheetI
D
string
`xml:"sheetId,attr,omitempty"`
I
D
string
`xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
State
string
`xml:"state,attr,omitempty"`
}
...
...
@@ -161,7 +161,7 @@ type xlsxDefinedName struct {
// currently I have not checked it for completeness - it does as much
// as I need.
type
xlsxCalcPr
struct
{
CalcI
d
string
`xml:"calcId,attr,omitempty"`
CalcI
D
string
`xml:"calcId,attr,omitempty"`
IterateCount
int
`xml:"iterateCount,attr,omitempty"`
RefMode
string
`xml:"refMode,attr,omitempty"`
Iterate
bool
`xml:"iterate,attr,omitempty"`
...
...
xmlWorksheet.go
浏览文件 @
192af02a
...
...
@@ -28,7 +28,7 @@ type xlsxWorksheet struct {
// xlsxDrawing change r:id to rid in the namespace
type
xlsxDrawing
struct
{
RI
d
string
`xml:"rid,attr"`
RI
D
string
`xml:"rid,attr"`
}
// xlsxHeaderFooter directly maps the headerFooter element in the namespace
...
...
@@ -144,7 +144,7 @@ type xlsxSheetView struct {
// ZoomScale float64 `xml:"zoomScale,attr"`
// ZoomScaleNormal float64 `xml:"zoomScaleNormal,attr"`
// ZoomScalePageLayoutView float64 `xml:"zoomScalePageLayoutView,attr"`
WorkbookViewI
d
int
`xml:"workbookViewId,attr"`
WorkbookViewI
D
int
`xml:"workbookViewId,attr"`
Selection
[]
xlsxSelection
`xml:"selection"`
Pane
*
xlsxPane
`xml:"pane,omitempty"`
}
...
...
@@ -156,7 +156,7 @@ type xlsxSheetView struct {
type
xlsxSelection
struct
{
Pane
string
`xml:"pane,attr,omitempty"`
ActiveCell
string
`xml:"activeCell,attr"`
ActiveCellI
d
int
`xml:"activeCellId,attr"`
ActiveCellI
D
int
`xml:"activeCellId,attr"`
SQRef
string
`xml:"sqref,attr"`
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录