summaryrefslogtreecommitdiff
path: root/chart.go
diff options
context:
space:
mode:
Diffstat (limited to 'chart.go')
-rw-r--r--chart.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/chart.go b/chart.go
index ae31f71..978a2f9 100644
--- a/chart.go
+++ b/chart.go
@@ -16,6 +16,7 @@ import (
"encoding/xml"
"errors"
"fmt"
+ "path/filepath"
"strconv"
"strings"
)
@@ -800,9 +801,11 @@ func (f *File) AddChartSheet(sheet, format string, combo ...string) error {
f.addContentTypePart(chartID, "chart")
f.addContentTypePart(sheetID, "chartsheet")
f.addContentTypePart(drawingID, "drawings")
- // Update xl/_rels/workbook.xml.rels
- rID := f.addRels("xl/_rels/workbook.xml.rels", SourceRelationshipChartsheet, fmt.Sprintf("chartsheets/sheet%d.xml", sheetID), "")
- // Update xl/workbook.xml
+ // Update workbook.xml.rels
+ wbPath := f.getWorkbookPath()
+ wbRelsPath := strings.TrimPrefix(filepath.Join(filepath.Dir(wbPath), "_rels", filepath.Base(wbPath)+".rels"), string(filepath.Separator))
+ rID := f.addRels(wbRelsPath, SourceRelationshipChartsheet, fmt.Sprintf("/xl/chartsheets/sheet%d.xml", sheetID), "")
+ // Update workbook.xml
f.setWorkbook(sheet, sheetID, rID)
chartsheet, _ := xml.Marshal(cs)
f.addSheetNameSpace(sheet, NameSpaceSpreadSheet)