summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-09-16 01:17:35 +0800
committerxuri <xuri.me@gmail.com>2019-09-16 01:17:35 +0800
commit8922f659788187afa6d0a5d3248e999c2c1bb846 (patch)
tree29b2aae2028eaedc448daef08a5670d6f3ca4604
parenta3ee098ab60d9528a0d6b7a7c475ea8ff7ebaba5 (diff)
Combine functions:
workBookRelsWriter, drawingRelsWriter into relsWriter; drawingRelsReader, workbookRelsReader, workSheetRelsReader into relsReader; addDrawingRelationships, addSheetRelationships into addRels
-rw-r--r--README.md2
-rw-r--r--README_zh.md2
-rw-r--r--cell.go4
-rw-r--r--chart.go7
-rw-r--r--comment.go8
-rw-r--r--excelize.go33
-rw-r--r--excelize.pngbin27196 -> 0 bytes
-rw-r--r--excelize.svg1
-rw-r--r--file.go9
-rw-r--r--picture.go136
-rw-r--r--shape.go4
-rw-r--r--sheet.go85
-rw-r--r--table.go4
-rw-r--r--xmlDrawing.go2
-rw-r--r--xmlPivotCache.go4
-rw-r--r--xmlPivotTable.go150
-rw-r--r--xmlWorkbook.go12
17 files changed, 190 insertions, 273 deletions
diff --git a/README.md b/README.md
index 7f9cf70..998a4c1 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-<p align="center"><img width="650" src="./excelize.png" alt="Excelize logo"></p>
+<p align="center"><img width="650" src="./excelize.svg" alt="Excelize logo"></p>
<p align="center">
<a href="https://travis-ci.org/360EntSecGroup-Skylar/excelize"><img src="https://travis-ci.org/360EntSecGroup-Skylar/excelize.svg?branch=master" alt="Build Status"></a>
diff --git a/README_zh.md b/README_zh.md
index 6c2b190..d4cac66 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -1,4 +1,4 @@
-<p align="center"><img width="650" src="./excelize.png" alt="Excelize logo"></p>
+<p align="center"><img width="650" src="./excelize.svg" alt="Excelize logo"></p>
<p align="center">
<a href="https://travis-ci.org/360EntSecGroup-Skylar/excelize"><img src="https://travis-ci.org/360EntSecGroup-Skylar/excelize.svg?branch=master" alt="Build Status"></a>
diff --git a/cell.go b/cell.go
index e897379..1da46aa 100644
--- a/cell.go
+++ b/cell.go
@@ -378,7 +378,9 @@ func (f *File) SetCellHyperLink(sheet, axis, link, linkType string) error {
linkData = xlsxHyperlink{
Ref: axis,
}
- rID := f.addSheetRelationships(sheet, SourceRelationshipHyperLink, link, linkType)
+ sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipHyperLink, link, linkType)
linkData.RID = "rId" + strconv.Itoa(rID)
case "Location":
linkData = xlsxHyperlink{
diff --git a/chart.go b/chart.go
index e1eb81f..db2df1e 100644
--- a/chart.go
+++ b/chart.go
@@ -727,7 +727,8 @@ func (f *File) AddChart(sheet, cell, format string) error {
chartID := f.countCharts() + 1
drawingXML := "xl/drawings/drawing" + strconv.Itoa(drawingID) + ".xml"
drawingID, drawingXML = f.prepareDrawing(xlsx, drawingID, sheet, drawingXML)
- drawingRID := f.addDrawingRelationships(drawingID, SourceRelationshipChart, "../charts/chart"+strconv.Itoa(chartID)+".xml", "")
+ drawingRels := "xl/drawings/_rels/drawing" + strconv.Itoa(drawingID) + ".xml.rels"
+ drawingRID := f.addRels(drawingRels, SourceRelationshipChart, "../charts/chart"+strconv.Itoa(chartID)+".xml", "")
err = f.addDrawingChart(sheet, drawingXML, cell, formatSet.Dimension.Width, formatSet.Dimension.Height, drawingRID, &formatSet.Format)
if err != nil {
return err
@@ -761,7 +762,9 @@ func (f *File) prepareDrawing(xlsx *xlsxWorksheet, drawingID int, sheet, drawing
drawingXML = strings.Replace(sheetRelationshipsDrawingXML, "..", "xl", -1)
} else {
// Add first picture for given sheet.
- rID := f.addSheetRelationships(sheet, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
+ sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
f.addSheetDrawing(sheet, rID)
}
return drawingID, drawingXML
diff --git a/comment.go b/comment.go
index 97e0e9b..7f3b10d 100644
--- a/comment.go
+++ b/comment.go
@@ -60,7 +60,7 @@ func (f *File) GetComments() (comments map[string][]Comment) {
// given worksheet index.
func (f *File) getSheetComments(sheetID int) string {
var rels = "xl/worksheets/_rels/sheet" + strconv.Itoa(sheetID) + ".xml.rels"
- if sheetRels := f.workSheetRelsReader(rels); sheetRels != nil {
+ if sheetRels := f.relsReader(rels); sheetRels != nil {
for _, v := range sheetRels.Relationships {
if v.Type == SourceRelationshipComments {
return v.Target
@@ -98,8 +98,10 @@ func (f *File) AddComment(sheet, cell, format string) error {
drawingVML = strings.Replace(sheetRelationshipsDrawingVML, "..", "xl", -1)
} else {
// Add first comment for given sheet.
- rID := f.addSheetRelationships(sheet, SourceRelationshipDrawingVML, sheetRelationshipsDrawingVML, "")
- f.addSheetRelationships(sheet, SourceRelationshipComments, sheetRelationshipsComments, "")
+ sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipDrawingVML, sheetRelationshipsDrawingVML, "")
+ f.addRels(sheetRels, SourceRelationshipComments, sheetRelationshipsComments, "")
f.addSheetLegacyDrawing(sheet, rID)
}
commentsXML := "xl/comments" + strconv.Itoa(commentID) + ".xml"
diff --git a/excelize.go b/excelize.go
index b734e57..4d46b94 100644
--- a/excelize.go
+++ b/excelize.go
@@ -31,7 +31,6 @@ type File struct {
CalcChain *xlsxCalcChain
Comments map[string]*xlsxComments
ContentTypes *xlsxTypes
- DrawingRels map[string]*xlsxWorkbookRels
Drawings map[string]*xlsxWsDr
Path string
SharedStrings *xlsxSST
@@ -42,8 +41,7 @@ type File struct {
DecodeVMLDrawing map[string]*decodeVmlDrawing
VMLDrawing map[string]*vmlDrawing
WorkBook *xlsxWorkbook
- WorkBookRels *xlsxWorkbookRels
- WorkSheetRels map[string]*xlsxWorkbookRels
+ Relationships map[string]*xlsxRelationships
XLSX map[string][]byte
}
@@ -93,13 +91,12 @@ func OpenReader(r io.Reader) (*File, error) {
f := &File{
checked: make(map[string]bool),
Comments: make(map[string]*xlsxComments),
- DrawingRels: make(map[string]*xlsxWorkbookRels),
Drawings: make(map[string]*xlsxWsDr),
Sheet: make(map[string]*xlsxWorksheet),
SheetCount: sheetCount,
DecodeVMLDrawing: make(map[string]*decodeVmlDrawing),
VMLDrawing: make(map[string]*vmlDrawing),
- WorkSheetRels: make(map[string]*xlsxWorkbookRels),
+ Relationships: make(map[string]*xlsxRelationships),
XLSX: file,
}
f.CalcChain = f.calcChainReader()
@@ -176,6 +173,28 @@ func checkSheet(xlsx *xlsxWorksheet) {
xlsx.SheetData = sheetData
}
+// addRels provides a function to add relationships by given XML path,
+// relationship type, target and target mode.
+func (f *File) addRels(relPath, relType, target, targetMode string) int {
+ rels := f.relsReader(relPath)
+ rID := 0
+ if rels == nil {
+ rels = &xlsxRelationships{}
+ }
+ rID = len(rels.Relationships) + 1
+ var ID bytes.Buffer
+ ID.WriteString("rId")
+ ID.WriteString(strconv.Itoa(rID))
+ rels.Relationships = append(rels.Relationships, xlsxRelationship{
+ ID: ID.String(),
+ Type: relType,
+ Target: target,
+ TargetMode: targetMode,
+ })
+ f.Relationships[relPath] = rels
+ return rID
+}
+
// replaceWorkSheetsRelationshipsNameSpaceBytes provides a function to replace
// xl/worksheets/sheet%d.xml XML tags to self-closing for compatible Microsoft
// Office Excel 2007.
@@ -265,7 +284,7 @@ func (f *File) AddVBAProject(bin string) error {
return errors.New("unsupported VBA project extension")
}
f.setContentTypePartVBAProjectExtensions()
- wb := f.workbookRelsReader()
+ wb := f.relsReader("xl/_rels/workbook.xml.rels")
var rID int
var ok bool
for _, rel := range wb.Relationships {
@@ -280,7 +299,7 @@ func (f *File) AddVBAProject(bin string) error {
}
rID++
if !ok {
- wb.Relationships = append(wb.Relationships, xlsxWorkbookRelation{
+ wb.Relationships = append(wb.Relationships, xlsxRelationship{
ID: "rId" + strconv.Itoa(rID),
Target: "vbaProject.bin",
Type: SourceRelationshipVBAProject,
diff --git a/excelize.png b/excelize.png
deleted file mode 100644
index 8ba520e..0000000
--- a/excelize.png
+++ /dev/null
Binary files differ
diff --git a/excelize.svg b/excelize.svg
new file mode 100644
index 0000000..afa8828
--- /dev/null
+++ b/excelize.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg enable-background="new 0 0 5791 2370" viewBox="0 0 5791 2370" xmlns="http://www.w3.org/2000/svg"><title>Excelize logo</title><defs><font-face ascent="1010.5438" cap-height="750" descent="-262.49695" panose-1="2 0 4 0 0 0 0 0 0 0" underline-position="-32.8125" underline-thickness="67.1875" x-height="583.59375"><font-face-src><font-face-name name="Krungthep"/></font-face-src></font-face><font-face ascent="1e3" cap-height="708" descent="-365.9973" panose-1="2 11 5 3 2 2 3 2 2 4" underline-position="-75" underline-thickness="50" x-height="468"><font-face-src><font-face-name name="Avenir-Roman"/></font-face-src></font-face></defs><path d="m1106.5 368.9c94.6-135.6 282.8 24.1 153.5 128.6z" fill="#6ad7e5"/><path d="m1106.5 368.9c94.6-135.6 282.8 24.1 153.5 128.6z" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m435.8 741.2c-176.7-17.7-89.3-253.9 61.4-189.6z" fill="#6ad7e5"/><path d="m435.8 741.2c-176.7-17.7-89.3-253.9 61.4-189.6z" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1223.9 442.3c15.4-20.3 23.5-42 0-59.8-21.8-16.5-42.2-4.1-57.6 16.3z"/><path d="m441.5 679.1c-24.3-7.8-43.4-20.9-34.3-49 8.4-26 32.2-27.5 56.5-19.7z"/><path d="m787 376.4c166-41.4 327.6-56.5 448.5 82.8 117.4 160.6 139.6 359.9 197.8 546.1 50 159.9 117.9 342.1 80.1 511.2-39.7 177.9-227.7 267.1-392.2 301.9-129.2 27.3-294.3 24.1-395.7-74.8-119-116.1-129.7-330.2-161.7-484.4-37.8-182.8-139.3-350.2-124-542 15.8-199 171.8-282 347.2-340.8" fill="#6ad7e5"/><path d="m787 376.4c166-41.4 327.6-56.5 448.5 82.8 117.4 160.6 139.6 359.9 197.8 546.1 50 159.9 117.9 342.1 80.1 511.2-39.7 177.9-227.7 267.1-392.2 301.9-129.2 27.3-294.3 24.1-395.7-74.8-119-116.1-129.7-330.2-161.7-484.4-37.8-182.8-139.3-350.2-124-542 15.8-199 171.8-282 347.2-340.8" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m826.3 734.6c-32.5 11.1-49.7 57.3-24.7 84.2 33.1 35.6 72.9-22.1 105.7-25.8 36.7-8.4 76.1 22.1 97.5-17 23.8-43.5-31.5-66.3-71.8-72.6z" fill="#f6d2a2"/><path d="m826.3 734.6c-32.5 11.1-49.7 57.3-24.7 84.2 33.1 35.6 72.9-22.1 105.7-25.8 36.7-8.4 76.1 22.1 97.5-17 23.8-43.5-31.5-66.3-71.8-72.6z" fill="none" stroke="#231f20" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m821.7 734c-16.8-56.8 91-91.3 115.9-46.5 24.9 44.7-99.9 87.7-115.9 46.5-12.7-33 0 0 0 0z"/><path d="m957.9 789.4c5.7 22.5 17 46.5 18.8 71.6-3 12.3-14 16.3-22.7 23.1-14 1.2-27.5-4.8-36-16-10.3-26.5-12.1-54.2-18.1-81.7z" fill="#fff"/><path d="m957.9 789.4c5.7 22.5 17 46.5 18.8 71.6-3 12.3-14 16.3-22.7 23.1-14 1.2-27.5-4.8-36-16-10.3-26.5-12.1-54.2-18.1-81.7z" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m540.6 705.6c76.3 141.2 308.2 42.4 261.3-106.7-56.1-178.5-344.5-69.4-261.3 106.7" fill="#fff"/><path d="m540.6 705.6c76.3 141.2 308.2 42.4 261.3-106.7-56.1-178.5-344.5-69.4-261.3 106.7" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m872.1 593.2c73 165.9 344.8 49.4 260.6-115.2-75.6-147.7-310.6-43-260.6 115.2" fill="#fff"/><path d="m872.1 593.2c73 165.9 344.8 49.4 260.6-115.2-75.6-147.7-310.6-43-260.6 115.2" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1524.7 1027.4c-6.9-.8-14-.8-19.7-5.4" fill="#c6b198"/><path d="m1524.7 1027.4c-6.9-.8-14-.8-19.7-5.4" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m841 819.2c-7 47.6 42.2 126.9 74.6 51.2-10.3-26.5-12.1-54.2-18.1-81.7z" fill="#fff"/><path d="m841 819.2c-7 47.6 42.2 126.9 74.6 51.2-10.3-26.5-12.1-54.2-18.1-81.7z" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1530.9 1006.3c8.7 43.8-39.6 34.6-62.6 25.9-21.8-8.2-24.6 3.8-32.5-21.1-5.2-16.4-11.3-32.6-14.5-49.6 27.5-9.6 59.8-10.5 87 .5 14 5.7 43.1 27.7 22.6 44.3" fill="#f6d2a2"/><path d="m1530.9 1006.3c8.7 43.8-39.6 34.6-62.6 25.9-21.8-8.2-24.6 3.8-32.5-21.1-5.2-16.4-11.3-32.6-14.5-49.6 27.5-9.6 59.8-10.5 87 .5 14 5.7 43.1 27.7 22.6 44.3" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1546.3 1714.5c-11.1-12.9-17.9-29.5-33.2-38.3" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1473.8 1612.3c38.5 12.3 115 59.5 72.5 102.2-37.1 56-87-29.6-132.4-31.9 12.1-29.2 29.5-57.4 59.9-70.3z" fill="#f6d2a2"/><path d="m1473.8 1612.3c38.5 12.3 115 59.5 72.5 102.2-37.1 56-87-29.6-132.4-31.9 12.1-29.2 29.5-57.4 59.9-70.3z" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1049.2 562.9c20 13.3 26.9 41.3 15.6 62.5-11.4 21.2-36.8 27.5-56.7 14.1-20-13.3-26.9-41.3-15.6-62.5 11.4-21.1 36.8-27.5 56.7-14.1"/><path d="m1043.6 607.6c4.8 3.5 6.6 10.6 4 15.9s-8.6 6.8-13.4 3.3-6.6-10.6-4-15.9 8.6-6.8 13.4-3.3" fill="#fff"/><path d="m698.4 668.9c20.2 13.3 27.2 41.3 15.6 62.5s-37.5 27.7-57.7 14.4-27.2-41.3-15.6-62.5 37.5-27.7 57.7-14.4"/><path d="m693.6 719.2c4.8 3.4 6.6 10.6 4 15.9-2.7 5.3-8.8 6.8-13.6 3.4s-6.6-10.6-4-15.9c2.7-5.4 8.8-6.9 13.6-3.4" fill="#fff"/><path d="m475.8 1294.8c5.7-3.9 12-7.2 14.8-14" fill="#c6b198"/><path d="m475.8 1294.8c5.7-3.9 12-7.2 14.8-14" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/><path d="m475 1294.8c12.9 42.8 51.2 12 67.4-6.5 15.4-17.5 23.5-8.2 18.8-33.9-3.1-16.9-5.3-34.1-10.4-50.6-28.8 4.5-57.7 18.8-76.6 41.3-9.7 11.6-25.1 44.7.8 49.7" fill="#f6d2a2"/><path d="m475 1294.8c12.9 42.8 51.2 12 67.4-6.5 15.4-17.5 23.5-8.2 18.8-33.9-3.1-16.9-5.3-34.1-10.4-50.6-28.8 4.5-57.7 18.8-76.6 41.3-9.7 11.6-25.1 44.7.8 49.7" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/><path d="m1235.4 1017.8h-393.3c-27.2 0-49.2 22-49.2 49.2v209l442.5 258.1 221.2 93.4 221.2-93.4v-258.1z" fill="#21a366"/><path d="m792.9 1275.9h442.5v258.1h-442.5z" fill="#107c41"/><path d="m1628.8 1017.8h-393.3v258.1h442.5v-209c0-13-5.2-25.5-14.4-34.8s-21.8-14.4-34.8-14.3z" fill="#33c481"/><path d="m1235.4 1534h-442.5v467.1c0 27.2 22 49.2 49.2 49.2h786.7c27.2 0 49.2-22 49.2-49.2v-209z" fill="#185c37"/><path d="m1235.4 1534h442.5v258.1h-442.5z" fill="#107c41"/><path d="m1075.6 1262.6h-282.7v626.9h282.7c27.1-.1 49.1-22 49.2-49.2v-528.5c-.1-27.2-22-49.1-49.2-49.2z" fill="#165634"/><path d="m1038.8 1239h-245.9v626.9h245.8c27.1-.1 49.1-22 49.2-49.2v-528.5c-.1-27.2-22-49.1-49.1-49.2z" fill="#13452b"/><path d="m547.1 1239h491.7c27.2 0 49.2 22 49.2 49.2v491.7c0 27.2-22 49.2-49.2 49.2h-491.7c-13 0-25.5-5.2-34.8-14.4-9.2-9.2-14.4-21.7-14.4-34.8v-491.7c0-27.2 22-49.2 49.2-49.2z" fill="#107c41"/><path d="m637.3 1700.2 100.8-156.1-92.3-155.3h74.2l50.4 99.2c4.6 9.4 7.8 16.4 9.6 21.1h.7c3.3-7.5 6.8-14.8 10.4-21.9l53.8-98.4h68.2l-94.7 154.4 97.1 157h-72.5l-58.2-109c-2.7-4.6-5.1-9.5-6.9-14.5h-.9c-1.7 4.9-4 9.7-6.7 14.1l-59.9 109.4z" fill="#fff"/><g enable-background="new" fill="#53cad7"><path d="m2407.2 1119v-450h249.8v50.2h-150v150h100.3v49.7h-100.3v150h150v50.2h-249.8z"/><path d="m2757.3 1119v-75c0-29.5 8.4-52.6 25.1-69.1 16.7-16.6 41.6-26.8 74.8-30.7-33.1-3.9-58-14.2-74.8-30.9-16.7-16.7-25.1-39.8-25.1-69.4v-75h99.8v100.3c0 13.6 4.9 25.3 14.8 35 9.8 9.8 21.6 14.6 35.4 14.6 13.6 0 25.3-4.9 35.3-14.6 9.9-9.8 14.9-21.4 14.9-35v-100.4h99.8v75c0 29.5-8.3 52.7-25 69.4-16.6 16.7-41.6 27-74.9 30.9 33.3 3.9 58.2 14.2 74.9 30.8s25 39.6 25 69v75h-99.8v-99.8c0-13.7-5-25.5-14.9-35.4-9.9-9.8-21.7-14.8-35.3-14.8-13.8 0-25.5 4.9-35.4 14.8s-14.8 21.6-14.8 35.4v99.8h-99.8z"/><path d="m3407 869.2h-49.7c-3.9-33.4-20.6-50.2-50.2-50.2-13.8 0-25.5 4.9-35.4 14.8s-14.8 21.6-14.8 35.4v150c0 13.4 4.9 25.1 14.6 34.9 9.8 9.8 21.6 14.8 35.5 14.8 29.5 0 46.2-16.6 50.2-49.7h49.7c-4.1 66.6-37.3 99.8-99.8 99.8h-50.1c-27.3 0-50.8-9.8-70.4-29.4s-29.4-43.1-29.4-70.4v-150c0-27.7 9.8-51.3 29.5-70.9s43.1-29.4 70.3-29.4h50.2c62.8-.1 96 33.4 99.8 100.3z"/><path d="m3807.3 969h-200.2v50.2c0 13.4 4.9 25.1 14.6 34.9 9.8 9.8 21.6 14.8 35.5 14.8h50.2c33.1 0 49.7-16.6 49.7-49.7h50.2c-7.8 66.6-41.1 99.8-99.8 99.8h-100.3c-27.3 0-50.8-9.8-70.4-29.4s-29.4-43.1-29.4-70.4v-150c0-27.7 9.8-51.3 29.5-70.9s43.1-29.4 70.3-29.4h100.3c27.3 0 50.8 9.9 70.4 29.6 19.6 19.8 29.4 43.3 29.4 70.7zm-200.2-50.2h100.3v-49.7c0-13.7-5-25.5-14.9-35.4-9.9-9.8-21.7-14.8-35.3-14.8-13.8 0-25.5 4.9-35.4 14.8s-14.8 21.6-14.8 35.4v49.7z"/><path d="m3907.1 1119v-450h99.8v450z"/><path d="m4107.3 719.2v-50.2h99.8v50.2zm0 399.8v-350.2h99.8v350.2z"/><path d="m4307.4 768.8h300v50.2l-200.2 249.8h200.2v50.2h-300v-50.2l200.2-249.8h-200.2z"/><path d="m5007.3 969h-200.2v50.2c0 13.4 4.9 25.1 14.6 34.9 9.8 9.8 21.6 14.8 35.5 14.8h50.2c33.1 0 49.7-16.6 49.7-49.7h50.2c-7.8 66.6-41.1 99.8-99.8 99.8h-100.3c-27.3 0-50.8-9.8-70.4-29.4s-29.4-43.1-29.4-70.4v-150c0-27.7 9.8-51.3 29.5-70.9s43.1-29.4 70.3-29.4h100.3c27.3 0 50.8 9.9 70.4 29.6 19.6 19.8 29.4 43.3 29.4 70.7zm-200.2-50.2h100.3v-49.7c0-13.7-5-25.5-14.9-35.4-9.9-9.8-21.7-14.8-35.3-14.8-13.8 0-25.5 4.9-35.4 14.8s-14.8 21.6-14.8 35.4v49.7z"/></g><g enable-background="new" fill="#5e5e5e"><path d="m2263 1657.4c-6.4 3.6-13.2 6.2-20.3 7.9s-14.3 2.5-21.6 2.5c-8.7 0-16.7-1.4-24-4.3-7.3-2.8-13.6-6.8-18.9-12s-9.5-11.3-12.4-18.6c-3-7.2-4.4-15.2-4.4-23.9 0-8.8 1.6-16.9 4.7-24.1s7.4-13.4 12.9-18.5 11.9-9.1 19.1-11.9c7.3-2.8 15.1-4.3 23.5-4.3 7.4 0 14.5 1.1 21.3 3.3s12.9 6 18.2 11.4l-10 10.4c-3.8-4.1-8.4-7.3-13.8-9.5s-11-3.3-16.7-3.3c-6.4 0-12.4 1.2-17.9 3.5s-10.2 5.5-14.3 9.6-7.2 9-9.5 14.7-3.4 11.9-3.4 18.6c0 6.6 1.1 12.8 3.4 18.5s5.4 10.6 9.5 14.8 8.9 7.4 14.6 9.7 12 3.5 18.8 3.5c4.5 0 9.3-.6 14.2-1.7s9.5-2.7 13.6-4.8v-34.3h-25.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1.3 7.3-1.3 11.5v36h-12.3v-56.3z"/><path d="m4517.2 1661.7c0 13.5-3.5 23.7-10.3 30.7-6.9 7-16.9 10.5-29.9 10.5-7.3 0-13.8-1.1-19.7-3.2-5.8-2.1-11.4-5.7-16.7-10.9l8.8-10.1c3.9 4.2 8 7.4 12.4 9.6s9.4 3.2 15.1 3.2c5.5 0 10-.8 13.7-2.4 3.6-1.6 6.5-3.8 8.6-6.6s3.6-6 4.4-9.6 1.3-7.3 1.3-11.2v-9.5h-.3c-3 4.7-6.8 8.2-11.5 10.4s-9.6 3.3-14.5 3.3c-5.8 0-11.1-.9-16-2.8-4.8-1.9-9-4.5-12.5-7.9s-6.2-7.4-8.1-12-2.8-9.7-2.8-15.2c0-6 .9-11.4 2.8-16.3 1.9-4.8 4.6-8.9 8-12.2s7.6-5.9 12.4-7.7 10.2-2.7 16.1-2.7c2.5 0 5.1.3 7.6.9s5 1.5 7.3 2.7c2.4 1.2 4.5 2.7 6.4 4.6 1.9 1.8 3.5 4 4.7 6.4h.3v-12.6h12.3v70.6zm-64.8-33.7c0 3.8.7 7.3 2.1 10.5s3.2 6 5.6 8.4 5.1 4.2 8.3 5.6 6.5 2.1 10.1 2.1c4.2 0 8-.7 11.2-2.2 3.3-1.5 6-3.4 8.3-5.9s4-5.3 5.1-8.5c1.2-3.2 1.7-6.6 1.7-10.2 0-4-.6-7.7-1.9-11s-3.1-6.2-5.4-8.6-5.1-4.3-8.4-5.6-6.8-2-10.7-2-7.5.7-10.7 2.1-6 3.4-8.2 5.8c-2.3 2.5-4 5.4-5.3 8.7s-1.8 6.9-1.8 10.8z"/><path d="m4612.5 1606.1-37.6-52.9h17.1l30.2 43.8 29.9-43.8h16.6l-37.6 52.9 41.2 58.9h-17.5l-33.2-49.6-33.3 49.6h-16.4z"/><path d="m4685.6 1553.1h13.3v99.5h51.2v12.3h-64.5z"/><path d="m4817.7 1572.9c-2.2-3.6-5.2-6.2-8.8-7.8-3.7-1.6-7.5-2.4-11.5-2.4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3.5-5.7-5.9-2.1-5.5-2.1-9.3c0-3.6.8-6.7 2.4-9.5 1.6-2.7 3.7-5 6.3-6.8s5.6-3.2 8.8-4.1c3.3-.9 6.6-1.4 10.1-1.4 5.3 0 10.1 1.1 14.6 3.2s8 5.5 10.5 10.3l-10.3 6.8c-1.6-2.6-3.7-4.8-6.2-6.4-2.6-1.6-5.7-2.4-9.4-2.4-1.7 0-3.4.2-5.1.6s-3.3 1.1-4.7 1.9-2.5 1.9-3.4 3.2-1.3 2.8-1.3 4.5c0 1.6.5 2.9 1.5 4s2.4 2.1 4.1 2.9 3.7 1.6 6 2.2 4.6 1.2 7 1.6c3.3.6 6.4 1.4 9.3 2.4s5.5 2.3 7.7 4 4 3.8 5.2 6.3c1.3 2.5 1.9 5.6 1.9 9.3 0 4.2-.8 7.8-2.5 10.7-1.7 3-3.9 5.3-6.7 7.2-2.8 1.8-6 3.2-9.5 4s-7.1 1.3-10.8 1.3c-6.3 0-11.8-1-16.4-2.9s-8.7-5.6-12.4-10.8z"/></g></svg> \ No newline at end of file
diff --git a/file.go b/file.go
index 46f1f62..2e0d27b 100644
--- a/file.go
+++ b/file.go
@@ -42,14 +42,13 @@ func NewFile() *File {
f.CalcChain = f.calcChainReader()
f.Comments = make(map[string]*xlsxComments)
f.ContentTypes = f.contentTypesReader()
- f.DrawingRels = make(map[string]*xlsxWorkbookRels)
f.Drawings = make(map[string]*xlsxWsDr)
f.Styles = f.stylesReader()
f.DecodeVMLDrawing = make(map[string]*decodeVmlDrawing)
f.VMLDrawing = make(map[string]*vmlDrawing)
f.WorkBook = f.workbookReader()
- f.WorkBookRels = f.workbookRelsReader()
- f.WorkSheetRels = make(map[string]*xlsxWorkbookRels)
+ f.Relationships = make(map[string]*xlsxRelationships)
+ f.Relationships["xl/_rels/workbook.xml.rels"] = f.relsReader("xl/_rels/workbook.xml.rels")
f.Sheet["xl/worksheets/sheet1.xml"], _ = f.workSheetReader("Sheet1")
f.sheetMap["Sheet1"] = "xl/worksheets/sheet1.xml"
f.Theme = f.themeReader()
@@ -97,13 +96,11 @@ func (f *File) WriteToBuffer() (*bytes.Buffer, error) {
f.calcChainWriter()
f.commentsWriter()
f.contentTypesWriter()
- f.drawingRelsWriter()
f.drawingsWriter()
f.vmlDrawingWriter()
f.workBookWriter()
- f.workBookRelsWriter()
f.workSheetWriter()
- f.workSheetRelsWriter()
+ f.relsWriter()
f.styleSheetWriter()
for path, content := range f.XLSX {
diff --git a/picture.go b/picture.go
index a5904ff..518463a 100644
--- a/picture.go
+++ b/picture.go
@@ -155,14 +155,15 @@ func (f *File) AddPictureFromBytes(sheet, cell, format, name, extension string,
drawingID := f.countDrawings() + 1
drawingXML := "xl/drawings/drawing" + strconv.Itoa(drawingID) + ".xml"
drawingID, drawingXML = f.prepareDrawing(xlsx, drawingID, sheet, drawingXML)
+ drawingRels := "xl/drawings/_rels/drawing" + strconv.Itoa(drawingID) + ".xml.rels"
mediaStr := ".." + strings.TrimPrefix(f.addMedia(file, ext), "xl")
- drawingRID := f.addDrawingRelationships(drawingID, SourceRelationshipImage, mediaStr, hyperlinkType)
+ drawingRID := f.addRels(drawingRels, SourceRelationshipImage, mediaStr, hyperlinkType)
// Add picture with hyperlink.
if formatSet.Hyperlink != "" && formatSet.HyperlinkType != "" {
if formatSet.HyperlinkType == "External" {
hyperlinkType = formatSet.HyperlinkType
}
- drawingHyperlinkRID = f.addDrawingRelationships(drawingID, SourceRelationshipHyperLink, formatSet.Hyperlink, hyperlinkType)
+ drawingHyperlinkRID = f.addRels(drawingRels, SourceRelationshipHyperLink, formatSet.Hyperlink, hyperlinkType)
}
err = f.addDrawingPicture(sheet, drawingXML, cell, name, img.Width, img.Height, drawingRID, drawingHyperlinkRID, formatSet)
if err != nil {
@@ -172,37 +173,6 @@ func (f *File) AddPictureFromBytes(sheet, cell, format, name, extension string,
return err
}
-// addSheetRelationships provides a function to add
-// xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name, relationship
-// type and target.
-func (f *File) addSheetRelationships(sheet, relType, target, targetMode string) int {
- name, ok := f.sheetMap[trimSheetName(sheet)]
- if !ok {
- name = strings.ToLower(sheet) + ".xml"
- }
- var rels = "xl/worksheets/_rels/" + strings.TrimPrefix(name, "xl/worksheets/") + ".rels"
- sheetRels := f.workSheetRelsReader(rels)
- if sheetRels == nil {
- sheetRels = &xlsxWorkbookRels{}
- }
- var rID = 1
- var ID bytes.Buffer
- ID.WriteString("rId")
- ID.WriteString(strconv.Itoa(rID))
- ID.Reset()
- rID = len(sheetRels.Relationships) + 1
- ID.WriteString("rId")
- ID.WriteString(strconv.Itoa(rID))
- sheetRels.Relationships = append(sheetRels.Relationships, xlsxWorkbookRelation{
- ID: ID.String(),
- Type: relType,
- Target: target,
- TargetMode: targetMode,
- })
- f.WorkSheetRels[rels] = sheetRels
- return rID
-}
-
// deleteSheetRelationships provides a function to delete relationships in
// xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name and
// relationship index.
@@ -212,16 +182,16 @@ func (f *File) deleteSheetRelationships(sheet, rID string) {
name = strings.ToLower(sheet) + ".xml"
}
var rels = "xl/worksheets/_rels/" + strings.TrimPrefix(name, "xl/worksheets/") + ".rels"
- sheetRels := f.workSheetRelsReader(rels)
+ sheetRels := f.relsReader(rels)
if sheetRels == nil {
- sheetRels = &xlsxWorkbookRels{}
+ sheetRels = &xlsxRelationships{}
}
for k, v := range sheetRels.Relationships {
if v.ID == rID {
sheetRels.Relationships = append(sheetRels.Relationships[:k], sheetRels.Relationships[k+1:]...)
}
}
- f.WorkSheetRels[rels] = sheetRels
+ f.Relationships[rels] = sheetRels
}
// addSheetLegacyDrawing provides a function to add legacy drawing element to
@@ -325,33 +295,6 @@ func (f *File) addDrawingPicture(sheet, drawingXML, cell, file string, width, he
return err
}
-// addDrawingRelationships provides a function to add image part relationships
-// in the file xl/drawings/_rels/drawing%d.xml.rels by given drawing index,
-// relationship type and target.
-func (f *File) addDrawingRelationships(index int, relType, target, targetMode string) int {
- var rels = "xl/drawings/_rels/drawing" + strconv.Itoa(index) + ".xml.rels"
- var rID = 1
- var ID bytes.Buffer
- ID.WriteString("rId")
- ID.WriteString(strconv.Itoa(rID))
- drawingRels := f.drawingRelsReader(rels)
- if drawingRels == nil {
- drawingRels = &xlsxWorkbookRels{}
- }
- ID.Reset()
- rID = len(drawingRels.Relationships) + 1
- ID.WriteString("rId")
- ID.WriteString(strconv.Itoa(rID))
- drawingRels.Relationships = append(drawingRels.Relationships, xlsxWorkbookRelation{
- ID: ID.String(),
- Type: relType,
- Target: target,
- TargetMode: targetMode,
- })
- f.DrawingRels[rels] = drawingRels
- return rID
-}
-
// countMedia provides a function to get media files count storage in the
// folder xl/media/image.
func (f *File) countMedia() int {
@@ -429,16 +372,20 @@ func (f *File) addContentTypePart(index int, contentType string) {
"drawings": f.setContentTypePartImageExtensions,
}
partNames := map[string]string{
- "chart": "/xl/charts/chart" + strconv.Itoa(index) + ".xml",
- "comments": "/xl/comments" + strconv.Itoa(index) + ".xml",
- "drawings": "/xl/drawings/drawing" + strconv.Itoa(index) + ".xml",
- "table": "/xl/tables/table" + strconv.Itoa(index) + ".xml",
+ "chart": "/xl/charts/chart" + strconv.Itoa(index) + ".xml",
+ "comments": "/xl/comments" + strconv.Itoa(index) + ".xml",
+ "drawings": "/xl/drawings/drawing" + strconv.Itoa(index) + ".xml",
+ "table": "/xl/tables/table" + strconv.Itoa(index) + ".xml",
+ "pivotTable": "/xl/pivotTables/pivotTable" + strconv.Itoa(index) + ".xml",
+ "pivotCache": "/xl/pivotCache/pivotCacheDefinition" + strconv.Itoa(index) + ".xml",
}
contentTypes := map[string]string{
- "chart": "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
- "comments": "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
- "drawings": "application/vnd.openxmlformats-officedocument.drawing+xml",
- "table": "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
+ "chart": "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
+ "comments": "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
+ "drawings": "application/vnd.openxmlformats-officedocument.drawing+xml",
+ "table": "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
+ "pivotTable": "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
+ "pivotCache": "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml",
}
s, ok := setContentType[contentType]
if ok {
@@ -465,9 +412,9 @@ func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string {
name = strings.ToLower(sheet) + ".xml"
}
var rels = "xl/worksheets/_rels/" + strings.TrimPrefix(name, "xl/worksheets/") + ".rels"
- sheetRels := f.workSheetRelsReader(rels)
+ sheetRels := f.relsReader(rels)
if sheetRels == nil {
- sheetRels = &xlsxWorkbookRels{}
+ sheetRels = &xlsxRelationships{}
}
for _, v := range sheetRels.Relationships {
if v.ID == rID {
@@ -529,12 +476,12 @@ func (f *File) getPicture(row, col int, drawingXML, drawingRelationships string)
for _, anchor := range wsDr.TwoCellAnchor {
if anchor.From != nil && anchor.Pic != nil {
if anchor.From.Col == col && anchor.From.Row == row {
- xlsxWorkbookRelation := f.getDrawingRelationships(drawingRelationships,
+ xlsxRelationship := f.getDrawingRelationships(drawingRelationships,
anchor.Pic.BlipFill.Blip.Embed)
- _, ok := supportImageTypes[filepath.Ext(xlsxWorkbookRelation.Target)]
+ _, ok := supportImageTypes[filepath.Ext(xlsxRelationship.Target)]
if ok {
- return filepath.Base(xlsxWorkbookRelation.Target),
- []byte(f.XLSX[strings.Replace(xlsxWorkbookRelation.Target,
+ return filepath.Base(xlsxRelationship.Target),
+ []byte(f.XLSX[strings.Replace(xlsxRelationship.Target,
"..", "xl", -1)]), nil
}
}
@@ -548,10 +495,10 @@ func (f *File) getPicture(row, col int, drawingXML, drawingRelationships string)
_ = xml.Unmarshal([]byte("<decodeTwoCellAnchor>"+anchor.Content+"</decodeTwoCellAnchor>"), &decodeTwoCellAnchor)
if decodeTwoCellAnchor.From != nil && decodeTwoCellAnchor.Pic != nil {
if decodeTwoCellAnchor.From.Col == col && decodeTwoCellAnchor.From.Row == row {
- xlsxWorkbookRelation := f.getDrawingRelationships(drawingRelationships, decodeTwoCellAnchor.Pic.BlipFill.Blip.Embed)
- _, ok := supportImageTypes[filepath.Ext(xlsxWorkbookRelation.Target)]
+ xlsxRelationship := f.getDrawingRelationships(drawingRelationships, decodeTwoCellAnchor.Pic.BlipFill.Blip.Embed)
+ _, ok := supportImageTypes[filepath.Ext(xlsxRelationship.Target)]
if ok {
- return filepath.Base(xlsxWorkbookRelation.Target), []byte(f.XLSX[strings.Replace(xlsxWorkbookRelation.Target, "..", "xl", -1)]), nil
+ return filepath.Base(xlsxRelationship.Target), []byte(f.XLSX[strings.Replace(xlsxRelationship.Target, "..", "xl", -1)]), nil
}
}
}
@@ -562,8 +509,8 @@ func (f *File) getPicture(row, col int, drawingXML, drawingRelationships string)
// getDrawingRelationships provides a function to get drawing relationships
// from xl/drawings/_rels/drawing%s.xml.rels by given file name and
// relationship ID.
-func (f *File) getDrawingRelationships(rels, rID string) *xlsxWorkbookRelation {
- if drawingRels := f.drawingRelsReader(rels); drawingRels != nil {
+func (f *File) getDrawingRelationships(rels, rID string) *xlsxRelationship {
+ if drawingRels := f.relsReader(rels); drawingRels != nil {
for _, v := range drawingRels.Relationships {
if v.ID == rID {
return &v
@@ -573,31 +520,6 @@ func (f *File) getDrawingRelationships(rels, rID string) *xlsxWorkbookRelation {
return nil
}
-// drawingRelsReader provides a function to get the pointer to the structure
-// after deserialization of xl/drawings/_rels/drawing%d.xml.rels.
-func (f *File) drawingRelsReader(rel string) *xlsxWorkbookRels {
- if f.DrawingRels[rel] == nil {
- _, ok := f.XLSX[rel]
- if ok {
- d := xlsxWorkbookRels{}
- _ = xml.Unmarshal(namespaceStrictToTransitional(f.readXML(rel)), &d)
- f.DrawingRels[rel] = &d
- }
- }
- return f.DrawingRels[rel]
-}
-
-// drawingRelsWriter provides a function to save
-// xl/drawings/_rels/drawing%d.xml.rels after serialize structure.
-func (f *File) drawingRelsWriter() {
- for path, d := range f.DrawingRels {
- if d != nil {
- v, _ := xml.Marshal(d)
- f.saveFileList(path, v)
- }
- }
-}
-
// drawingsWriter provides a function to save xl/drawings/drawing%d.xml after
// serialize structure.
func (f *File) drawingsWriter() {
diff --git a/shape.go b/shape.go
index 8d95849..e6a2ff3 100644
--- a/shape.go
+++ b/shape.go
@@ -275,7 +275,9 @@ func (f *File) AddShape(sheet, cell, format string) error {
drawingXML = strings.Replace(sheetRelationshipsDrawingXML, "..", "xl", -1)
} else {
// Add first shape for given sheet.
- rID := f.addSheetRelationships(sheet, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
+ name, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(name, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
f.addSheetDrawing(sheet, rID)
}
err = f.addDrawingShape(sheet, drawingXML, cell, formatSet)
diff --git a/sheet.go b/sheet.go
index ed6d888..951baf9 100644
--- a/sheet.go
+++ b/sheet.go
@@ -52,7 +52,7 @@ func (f *File) NewSheet(name string) int {
// Create new sheet /xl/worksheets/sheet%d.xml
f.setSheet(sheetID, name)
// Update xl/_rels/workbook.xml.rels
- rID := f.addXlsxWorkbookRels(sheetID)
+ rID := f.addRels("xl/_rels/workbook.xml.rels", SourceRelationshipWorkSheet, fmt.Sprintf("worksheets/sheet%d.xml", sheetID), "")
// Update xl/workbook.xml
f.setWorkbook(name, sheetID, rID)
return sheetID
@@ -163,50 +163,18 @@ func (f *File) setWorkbook(name string, sheetID, rid int) {
})
}
-// workbookRelsReader provides a function to read and unmarshal workbook
-// relationships of XLSX file.
-func (f *File) workbookRelsReader() *xlsxWorkbookRels {
- if f.WorkBookRels == nil {
- var content xlsxWorkbookRels
- _ = xml.Unmarshal(namespaceStrictToTransitional(f.readXML("xl/_rels/workbook.xml.rels")), &content)
- f.WorkBookRels = &content
- }
- return f.WorkBookRels
-}
-
-// workBookRelsWriter provides a function to save xl/_rels/workbook.xml.rels after
+// relsWriter provides a function to save relationships after
// serialize structure.
-func (f *File) workBookRelsWriter() {
- if f.WorkBookRels != nil {
- output, _ := xml.Marshal(f.WorkBookRels)
- f.saveFileList("xl/_rels/workbook.xml.rels", output)
- }
-}
-
-// addXlsxWorkbookRels update workbook relationships property of XLSX.
-func (f *File) addXlsxWorkbookRels(sheet int) int {
- content := f.workbookRelsReader()
- rID := 0
- for _, v := range content.Relationships {
- t, _ := strconv.Atoi(strings.TrimPrefix(v.ID, "rId"))
- if t > rID {
- rID = t
+func (f *File) relsWriter() {
+ for path, rel := range f.Relationships {
+ if rel != nil {
+ output, _ := xml.Marshal(rel)
+ if strings.HasPrefix(path, "xl/worksheets/sheet/rels/sheet") {
+ output = replaceWorkSheetsRelationshipsNameSpaceBytes(output)
+ }
+ f.saveFileList(path, replaceRelationshipsBytes(output))
}
}
- rID++
- ID := bytes.Buffer{}
- ID.WriteString("rId")
- ID.WriteString(strconv.Itoa(rID))
- target := bytes.Buffer{}
- target.WriteString("worksheets/sheet")
- target.WriteString(strconv.Itoa(sheet))
- target.WriteString(".xml")
- content.Relationships = append(content.Relationships, xlsxWorkbookRelation{
- ID: ID.String(),
- Target: target.String(),
- Type: SourceRelationshipWorkSheet,
- })
- return rID
}
// setAppXML update docProps/app.xml file of XML.
@@ -365,7 +333,7 @@ func (f *File) GetSheetMap() map[int]string {
// of XLSX.
func (f *File) getSheetMap() map[string]string {
content := f.workbookReader()
- rels := f.workbookRelsReader()
+ rels := f.relsReader("xl/_rels/workbook.xml.rels")
maps := map[string]string{}
for _, v := range content.Sheets.Sheet {
for _, rel := range rels.Relationships {
@@ -396,7 +364,9 @@ func (f *File) SetSheetBackground(sheet, picture string) error {
}
file, _ := ioutil.ReadFile(picture)
name := f.addMedia(file, ext)
- rID := f.addSheetRelationships(sheet, SourceRelationshipImage, strings.Replace(name, "xl", "..", 1), "")
+ sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipImage, strings.Replace(name, "xl", "..", 1), "")
f.addSheetPicture(sheet, rID)
f.setContentTypePartImageExtensions()
return err
@@ -413,7 +383,7 @@ func (f *File) DeleteSheet(name string) {
}
sheetName := trimSheetName(name)
wb := f.workbookReader()
- wbRels := f.workbookRelsReader()
+ wbRels := f.relsReader("xl/_rels/workbook.xml.rels")
for idx, sheet := range wb.Sheets.Sheet {
if sheet.Name == sheetName {
wb.Sheets.Sheet = append(wb.Sheets.Sheet[:idx], wb.Sheets.Sheet[idx+1:]...)
@@ -443,7 +413,7 @@ func (f *File) DeleteSheet(name string) {
// relationships by given relationships ID in the file
// xl/_rels/workbook.xml.rels.
func (f *File) deleteSheetFromWorkbookRels(rID string) string {
- content := f.workbookRelsReader()
+ content := f.relsReader("xl/_rels/workbook.xml.rels")
for k, v := range content.Relationships {
if v.ID == rID {
content.Relationships = append(content.Relationships[:k], content.Relationships[k+1:]...)
@@ -1387,29 +1357,18 @@ func (f *File) UngroupSheets() error {
return nil
}
-// workSheetRelsReader provides a function to get the pointer to the structure
+// relsReader provides a function to get the pointer to the structure
// after deserialization of xl/worksheets/_rels/sheet%d.xml.rels.
-func (f *File) workSheetRelsReader(path string) *xlsxWorkbookRels {
- if f.WorkSheetRels[path] == nil {
+func (f *File) relsReader(path string) *xlsxRelationships {
+ if f.Relationships[path] == nil {
_, ok := f.XLSX[path]
if ok {
- c := xlsxWorkbookRels{}
+ c := xlsxRelationships{}
_ = xml.Unmarshal(namespaceStrictToTransitional(f.readXML(path)), &c)
- f.WorkSheetRels[path] = &c
- }
- }
- return f.WorkSheetRels[path]
-}
-
-// workSheetRelsWriter provides a function to save
-// xl/worksheets/_rels/sheet%d.xml.rels after serialize structure.
-func (f *File) workSheetRelsWriter() {
- for p, r := range f.WorkSheetRels {
- if r != nil {
- v, _ := xml.Marshal(r)
- f.saveFileList(p, v)
+ f.Relationships[path] = &c
}
}
+ return f.Relationships[path]
}
// fillSheetData ensures there are enough rows, and columns in the chosen
diff --git a/table.go b/table.go
index 45a1622..d26f8fd 100644
--- a/table.go
+++ b/table.go
@@ -77,7 +77,9 @@ func (f *File) AddTable(sheet, hcell, vcell, format string) error {
sheetRelationshipsTableXML := "../tables/table" + strconv.Itoa(tableID) + ".xml"
tableXML := strings.Replace(sheetRelationshipsTableXML, "..", "xl", -1)
// Add first table for given sheet.
- rID := f.addSheetRelationships(sheet, SourceRelationshipTable, sheetRelationshipsTableXML, "")
+ sheetPath, _ := f.sheetMap[trimSheetName(sheet)]
+ sheetRels := "xl/worksheets/_rels/" + strings.TrimPrefix(sheetPath, "xl/worksheets/") + ".rels"
+ rID := f.addRels(sheetRels, SourceRelationshipTable, sheetRelationshipsTableXML, "")
f.addSheetTable(sheet, rID)
err = f.addTable(sheet, tableXML, hcol, hrow, vcol, vrow, tableID, formatSet)
if err != nil {
diff --git a/xmlDrawing.go b/xmlDrawing.go
index ade6261..4338c5e 100644
--- a/xmlDrawing.go
+++ b/xmlDrawing.go
@@ -22,6 +22,8 @@ const (
SourceRelationshipDrawingVML = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
SourceRelationshipHyperLink = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
SourceRelationshipWorkSheet = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
+ SourceRelationshipPivotTable = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable"
+ SourceRelationshipPivotCache = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition"
SourceRelationshipVBAProject = "http://schemas.microsoft.com/office/2006/relationships/vbaProject"
SourceRelationshipChart201506 = "http://schemas.microsoft.com/office/drawing/2015/06/chart"
SourceRelationshipChart20070802 = "http://schemas.microsoft.com/office/drawing/2007/8/2/chart"
diff --git a/xmlPivotCache.go b/xmlPivotCache.go
index 9e07931..0c00832 100644
--- a/xmlPivotCache.go
+++ b/xmlPivotCache.go
@@ -2,11 +2,11 @@ package excelize
import "encoding/xml"
-// pivotCacheDefinition represents the pivotCacheDefinition part. This part
+// xlsxPivotCacheDefinition represents the pivotCacheDefinition part. This part
// defines each field in the source data, including the name, the string
// resources of the instance data (for shared items), and information about
// the type of data that appears in the field.
-type xmlPivotCacheDefinition struct {
+type xlsxPivotCacheDefinition struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main pivotCacheDefinition"`
RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
Invalid bool `xml:"invalid,attr,omitempty"`
diff --git a/xmlPivotTable.go b/xmlPivotTable.go
index 16c469f..6f2a8e7 100644
--- a/xmlPivotTable.go
+++ b/xmlPivotTable.go
@@ -15,78 +15,84 @@ import "encoding/xml"
// non-null PivotTables. There exists one pivotTableDefinition for each
// PivotTableDefinition part
type xlsxPivotTableDefinition struct {
- XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main pivotTableDefinition"`
- Name string `xml:"name,attr"`
- CacheID int `xml:"cacheId,attr"`
- DataOnRows bool `xml:"dataOnRows,attr"`
- DataPosition int `xml:"dataPosition,attr"`
- DataCaption string `xml:"dataCaption,attr"`
- GrandTotalCaption string `xml:"grandTotalCaption,attr"`
- ErrorCaption string `xml:"errorCaption,attr"`
- ShowError bool `xml:"showError,attr"`
- MissingCaption string `xml:"missingCaption,attr"`
- ShowMissing bool `xml:"showMissing,attr"`
- PageStyle string `xml:"pageStyle,attr"`
- PivotTableStyle string `xml:"pivotTableStyle,attr"`
- VacatedStyle string `xml:"vacatedStyle,attr"`
- Tag string `xml:"tag,attr"`
- UpdatedVersion int `xml:"updatedVersion,attr"`
- MinRefreshableVersion int `xml:"minRefreshableVersion,attr"`
- AsteriskTotals bool `xml:"asteriskTotals,attr"`
- ShowItems bool `xml:"showItems,attr"`
- EditData bool `xml:"editData,attr"`
- DisableFieldList bool `xml:"disableFieldList,attr"`
- ShowCalcMbrs bool `xml:"showCalcMbrs,attr"`
- VisualTotals bool `xml:"visualTotals,attr"`
- ShowMultipleLabel bool `xml:"showMultipleLabel,attr"`
- ShowDataDropDown bool `xml:"showDataDropDown,attr"`
- ShowDrill bool `xml:"showDrill,attr"`
- PrintDrill bool `xml:"printDrill,attr"`
- ShowMemberPropertyTips bool `xml:"showMemberPropertyTips,attr"`
- ShowDataTips bool `xml:"showDataTips,attr"`
- EnableWizard bool `xml:"enableWizard,attr"`
- EnableDrill bool `xml:"enableDrill,attr"`
- EnableFieldProperties bool `xml:"enableFieldProperties,attr"`
- PreserveFormatting bool `xml:"preserveFormatting,attr"`
- UseAutoFormatting bool `xml:"useAutoFormatting,attr"`
- PageWrap int `xml:"pageWrap,attr"`
- PageOverThenDown bool `xml:"pageOverThenDown,attr"`
- SubtotalHiddenItems bool `xml:"subtotalHiddenItems,attr"`
- RowGrandTotals bool `xml:"rowGrandTotals,attr"`
- ColGrandTotals bool `xml:"colGrandTotals,attr"`
- FieldPrintTitles bool `xml:"fieldPrintTitles,attr"`
- ItemPrintTitles bool `xml:"itemPrintTitles,attr"`
- MergeItem bool `xml:"mergeItem,attr"`
- ShowDropZones bool `xml:"showDropZones,attr"`
- CreatedVersion int `xml:"createdVersion,attr"`
- Indent int `xml:"indent,attr"`
- ShowEmptyRow bool `xml:"showEmptyRow,attr"`
- ShowEmptyCol bool `xml:"showEmptyCol,attr"`
- ShowHeaders bool `xml:"showHeaders,attr"`
- Compact bool `xml:"compact,attr"`
- Outline bool `xml:"outline,attr"`
- OutlineData bool `xml:"outlineData,attr"`
- CompactData bool `xml:"compactData,attr"`
- Published bool `xml:"published,attr"`
- GridDropZones bool `xml:"gridDropZones,attr"`
- Immersive bool `xml:"immersive,attr"`
- MultipleFieldFilters bool `xml:"multipleFieldFilters,attr"`
- ChartFormat int `xml:"chartFormat,attr"`
- RowHeaderCaption string `xml:"rowHeaderCaption,attr"`
- ColHeaderCaption string `xml:"colHeaderCaption,attr"`
- FieldListSortAscending bool `xml:"fieldListSortAscending,attr"`
- MdxSubqueries bool `xml:"mdxSubqueries,attr"`
- CustomListSort bool `xml:"customListSort,attr"`
- Location *xlsxLocation `xml:"location"`
- PivotFields *xlsxPivotFields `xml:"pivotFields"`
- RowFields *xlsxRowFields `xml:"rowFields"`
- RowItems *xlsxRowItems `xml:"rowItems"`
- ColFields *xlsxColFields `xml:"colFields"`
- ColItems *xlsxColItems `xml:"colItems"`
- PageFields *xlsxPageFields `xml:"pageFields"`
- DataFields *xlsxDataFields `xml:"dataFields"`
- ConditionalFormats *xlsxConditionalFormats `xml:"conditionalFormats"`
- PivotTableStyleInfo *xlsxPivotTableStyleInfo `xml:"pivotTableStyleInfo"`
+ XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main pivotTableDefinition"`
+ Name string `xml:"name,attr"`
+ CacheID int `xml:"cacheId,attr"`
+ ApplyNumberFormats bool `xml:"applyNumberFormats,attr,omitempty"`
+ ApplyBorderFormats bool `xml:"applyBorderFormats,attr,omitempty"`
+ ApplyFontFormats bool `xml:"applyFontFormats,attr,omitempty"`
+ ApplyPatternFormats bool `xml:"applyPatternFormats,attr,omitempty"`
+ ApplyAlignmentFormats bool `xml:"applyAlignmentFormats,attr,omitempty"`
+ ApplyWidthHeightFormats bool `xml:"applyWidthHeightFormats,attr,omitempty"`
+ DataOnRows bool `xml:"dataOnRows,attr,omitempty"`
+ DataPosition int `xml:"dataPosition,attr,omitempty"`
+ DataCaption string `xml:"dataCaption,attr"`
+ GrandTotalCaption string `xml:"grandTotalCaption,attr,omitempty"`
+ ErrorCaption string `xml:"errorCaption,attr,omitempty"`
+ ShowError bool `xml:"showError,attr,omitempty"`
+ MissingCaption string `xml:"missingCaption,attr,omitempty"`
+ ShowMissing bool `xml:"showMissing,attr,omitempty"`
+ PageStyle string `xml:"pageStyle,attr,omitempty"`
+ PivotTableStyle string `xml:"pivotTableStyle,attr,omitempty"`
+ VacatedStyle string `xml:"vacatedStyle,attr,omitempty"`
+ Tag string `xml:"tag,attr,omitempty"`
+ UpdatedVersion int `xml:"updatedVersion,attr"`
+ MinRefreshableVersion int `xml:"minRefreshableVersion,attr"`
+ AsteriskTotals bool `xml:"asteriskTotals,attr,omitempty"`
+ ShowItems bool `xml:"showItems,attr,omitempty"`
+ EditData bool `xml:"editData,attr,omitempty"`
+ DisableFieldList bool `xml:"disableFieldList,attr,omitempty"`
+ ShowCalcMbrs bool `xml:"showCalcMbrs,attr,omitempty"`
+ VisualTotals bool `xml:"visualTotals,attr,omitempty"`
+ ShowMultipleLabel bool `xml:"showMultipleLabel,attr,omitempty"`
+ ShowDataDropDown bool `xml:"showDataDropDown,attr,omitempty"`
+ ShowDrill bool `xml:"showDrill,attr,omitempty"`
+ PrintDrill bool `xml:"printDrill,attr,omitempty"`
+ ShowMemberPropertyTips bool `xml:"showMemberPropertyTips,attr,omitempty"`
+ ShowDataTips bool `xml:"showDataTips,attr,omitempty"`
+ EnableWizard bool `xml:"enableWizard,attr,omitempty"`
+ EnableDrill bool `xml:"enableDrill,attr,omitempty"`
+ EnableFieldProperties bool `xml:"enableFieldProperties,attr,omitempty"`
+ PreserveFormatting bool `xml:"preserveFormatting,attr,omitempty"`
+ UseAutoFormatting bool `xml:"useAutoFormatting,attr"`
+ PageWrap int `xml:"pageWrap,attr,omitempty"`
+ PageOverThenDown bool `xml:"pageOverThenDown,attr,omitempty"`
+ SubtotalHiddenItems bool `xml:"subtotalHiddenItems,attr,omitempty"`
+ RowGrandTotals bool `xml:"rowGrandTotals,attr,omitempty"`
+ ColGrandTotals bool `xml:"colGrandTotals,attr,omitempty"`
+ FieldPrintTitles bool `xml:"fieldPrintTitles,attr,omitempty"`
+ ItemPrintTitles bool `xml:"itemPrintTitles,attr"`
+ MergeItem bool `xml:"mergeItem,attr,omitempty"`
+ ShowDropZones bool `xml:"showDropZones,attr,omitempty"`
+ CreatedVersion int `xml:"createdVersion,attr"`
+ Indent int `xml:"indent,attr,omitempty"`
+ ShowEmptyRow bool `xml:"showEmptyRow,attr,omitempty"`
+ ShowEmptyCol bool `xml:"showEmptyCol,attr,omitempty"`
+ ShowHeaders bool `xml:"showHeaders,attr,omitempty"`
+ Compact bool `xml:"compact,attr,omitempty"`
+ Outline bool `xml:"outline,attr,omitempty"`
+ OutlineData bool `xml:"outlineData,attr,omitempty"`
+ CompactData bool `xml:"compactData,attr,omitempty"`
+ Published bool `xml:"published,attr,omitempty"`
+ GridDropZones bool `xml:"gridDropZones,attr"`
+ Immersive bool `xml:"immersive,attr,omitempty"`
+ MultipleFieldFilters bool `xml:"multipleFieldFilters,attr,omitempty"`
+ ChartFormat int `xml:"chartFormat,attr,omitempty"`
+ RowHeaderCaption string `xml:"rowHeaderCaption,attr,omitempty"`
+ ColHeaderCaption string `xml:"colHeaderCaption,attr,omitempty"`
+ FieldListSortAscending bool `xml:"fieldListSortAscending,attr,omitempty"`
+ MdxSubqueries bool `xml:"mdxSubqueries,attr,omitempty"`
+ CustomListSort bool `xml:"customListSort,attr,omitempty"`
+ Location *xlsxLocation `xml:"location"`
+ PivotFields *xlsxPivotFields `xml:"pivotFields"`
+ RowFields *xlsxRowFields `xml:"rowFields"`
+ RowItems *xlsxRowItems `xml:"rowItems"`
+ ColFields *xlsxColFields `xml:"colFields"`
+ ColItems *xlsxColItems `xml:"colItems"`
+ PageFields *xlsxPageFields `xml:"pageFields"`
+ DataFields *xlsxDataFields `xml:"dataFields"`
+ ConditionalFormats *xlsxConditionalFormats `xml:"conditionalFormats"`
+ PivotTableStyleInfo *xlsxPivotTableStyleInfo `xml:"pivotTableStyleInfo"`
}
// xlsxLocation represents location information for the PivotTable.
diff --git a/xmlWorkbook.go b/xmlWorkbook.go
index 8150e29..765563b 100644
--- a/xmlWorkbook.go
+++ b/xmlWorkbook.go
@@ -11,14 +11,14 @@ package excelize
import "encoding/xml"
-// xmlxWorkbookRels contains xmlxWorkbookRelations which maps sheet id and sheet XML.
-type xlsxWorkbookRels struct {
- XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/relationships Relationships"`
- Relationships []xlsxWorkbookRelation `xml:"Relationship"`
+// xlsxRelationships describe references from parts to other internal resources in the package or to external resources.
+type xlsxRelationships struct {
+ XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/relationships Relationships"`
+ Relationships []xlsxRelationship `xml:"Relationship"`
}
-// xmlxWorkbookRelation maps sheet id and xl/worksheets/_rels/sheet%d.xml.rels
-type xlsxWorkbookRelation struct {
+// xlsxRelationship contains relations which maps id and XML.
+type xlsxRelationship struct {
ID string `xml:"Id,attr"`
Target string `xml:",attr"`
Type string `xml:",attr"`