forked from p30928647/excelize
Format code with golint rules
This commit is contained in:
parent
0a0a36bafd
commit
192af02a40
6
cell.go
6
cell.go
|
@ -6,14 +6,14 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// Get value from cell by given sheet index and axis in XLSX file
|
||||
// GetCellValue 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(readXml(file, name)), &xlsx)
|
||||
xml.Unmarshal([]byte(readXML(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(readXml(file, `xl/sharedStrings.xml`)), &shardStrings)
|
||||
xml.Unmarshal([]byte(readXML(file, `xl/sharedStrings.xml`)), &shardStrings)
|
||||
return shardStrings.SI[xlsxSI].T
|
||||
case "str":
|
||||
return v.V
|
||||
|
|
11
excelize.go
11
excelize.go
|
@ -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
|
||||
// SetCellInt 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(readXml(file, name)), &xlsx)
|
||||
xml.Unmarshal([]byte(readXML(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
|
||||
// SetCellStr 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(readXml(file, name)), &xlsx)
|
||||
xml.Unmarshal([]byte(readXML(file, name)), &xlsx)
|
||||
|
||||
rows := xAxis + 1
|
||||
cell := yAxis + 1
|
||||
|
|
23
file.go
23
file.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
8
lib.go
8
lib.go
|
@ -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 readXml(files []FileList, name string) string {
|
||||
func readXML(files []FileList, name string) string {
|
||||
for _, file := range files {
|
||||
if file.Key == name {
|
||||
return strings.Replace(file.Value, "<drawing r:id=", "<drawing rid=", -1)
|
||||
|
|
40
sheet.go
40
sheet.go
|
@ -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 = setAppXml(file)
|
||||
file = setAppXML(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(readXml(file, `[Content_Types].xml`)), &content)
|
||||
xml.Unmarshal([]byte(readXML(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{
|
||||
WorkbookViewId: 0,
|
||||
WorkbookViewID: 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(readXml(file, `xl/workbook.xml`)), &content)
|
||||
xml.Unmarshal([]byte(readXML(file, `xl/workbook.xml`)), &content)
|
||||
|
||||
rels := readXlsxWorkbookRels(file)
|
||||
rId := len(rels.Relationships)
|
||||
rID := len(rels.Relationships)
|
||||
content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{
|
||||
Name: name,
|
||||
SheetId: strconv.Itoa(index),
|
||||
Id: "rId" + strconv.Itoa(rId),
|
||||
SheetID: strconv.Itoa(index),
|
||||
ID: "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(readXml(file, `xl/_rels/workbook.xml.rels`)), &content)
|
||||
xml.Unmarshal([]byte(readXML(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)
|
||||
rId := len(content.Relationships) + 1
|
||||
rID := len(content.Relationships) + 1
|
||||
content.Relationships = append(content.Relationships, xlsxWorkbookRelation{
|
||||
Id: "rId" + strconv.Itoa(rId),
|
||||
ID: "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 setAppXml(file []FileList) []FileList {
|
||||
return saveFileList(file, `docProps/app.xml`, TEMPLATE_DOCPROPS_APP)
|
||||
func setAppXML(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
|
||||
// SetActiveSheet 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(readXml(file, `xl/workbook.xml`)), &content)
|
||||
index--
|
||||
xml.Unmarshal([]byte(readXML(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(readXml(file, path)), &xlsx)
|
||||
xml.Unmarshal([]byte(readXML(file, path)), &xlsx)
|
||||
if index == sheetIndex {
|
||||
if len(xlsx.SheetViews.SheetView) > 0 {
|
||||
xlsx.SheetViews.SheetView[0].TabSelected = true
|
||||
|
|
19
templates.go
19
templates.go
|
@ -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>`
|
||||
|
|
|
@ -23,7 +23,7 @@ type xlsxWorkbookRels struct {
|
|||
|
||||
// xmlxWorkbookRelation maps sheet id and xl/worksheets/sheet%d.xml
|
||||
type xlsxWorkbookRelation struct {
|
||||
Id string `xml:",attr"`
|
||||
ID 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"`
|
||||
SheetId string `xml:"sheetId,attr,omitempty"`
|
||||
Id string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
|
||||
SheetID string `xml:"sheetId,attr,omitempty"`
|
||||
ID 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 {
|
||||
CalcId string `xml:"calcId,attr,omitempty"`
|
||||
CalcID string `xml:"calcId,attr,omitempty"`
|
||||
IterateCount int `xml:"iterateCount,attr,omitempty"`
|
||||
RefMode string `xml:"refMode,attr,omitempty"`
|
||||
Iterate bool `xml:"iterate,attr,omitempty"`
|
||||
|
|
|
@ -28,7 +28,7 @@ type xlsxWorksheet struct {
|
|||
|
||||
// xlsxDrawing change r:id to rid in the namespace
|
||||
type xlsxDrawing struct {
|
||||
RId string `xml:"rid,attr"`
|
||||
RID 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"`
|
||||
WorkbookViewId int `xml:"workbookViewId,attr"`
|
||||
WorkbookViewID 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"`
|
||||
ActiveCellId int `xml:"activeCellId,attr"`
|
||||
ActiveCellID int `xml:"activeCellId,attr"`
|
||||
SQRef string `xml:"sqref,attr"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue