This commit is contained in:
Todd 2017-09-27 17:18:46 -05:00
parent e00296f899
commit 01bceae1db
2 changed files with 7 additions and 3 deletions

View File

@ -68,6 +68,11 @@ func NewStyleSheet(wb *Workbook) StyleSheet {
ss.CellXfs.Xf = append(ss.CellXfs.Xf, xf2)
ss.CellXfs.CountAttr = gooxml.Uint32(uint32(len(ss.CellXfs.Xf)))
ss.TableStyles = sml.NewCT_TableStyles()
ss.TableStyles.DefaultPivotStyleAttr = gooxml.String("PivotStyleMedium7")
ss.TableStyles.DefaultTableStyleAttr = gooxml.String("TableStyleMedium9")
return s
}

View File

@ -630,7 +630,8 @@ func (wb *Workbook) AddPivotTable() PivotTable {
wb.pivotCache = append(wb.pivotCache, pcache)
crel := common.NewRelationships()
wb.pivotCacheRels = append(wb.pivotCacheRels, crel)
crel.AddAutoRelationship(gooxml.DocTypeSpreadsheet, gooxml.PivotCacheDefinitionType, len(wb.pivotCache), gooxml.PivotCacheRecordsType)
recID := crel.AddAutoRelationship(gooxml.DocTypeSpreadsheet, gooxml.PivotCacheDefinitionType, len(wb.pivotCache), gooxml.PivotCacheRecordsType)
pcache.IdAttr = gooxml.String(recID.ID())
precs := sml.NewPivotCacheRecords()
wb.pivotRecords = append(wb.pivotRecords, precs)
@ -649,8 +650,6 @@ func (wb *Workbook) AddPivotTable() PivotTable {
pvd.CacheIdAttr = uint32(pc.CacheIdAttr)
// TODO: make configurable
pcache.IdAttr = gooxml.String("rId1")
pvd.Location.FirstHeaderRowAttr = 1
pvd.Location.FirstDataRowAttr = 2
pvd.Location.FirstDataColAttr = 1