hi,
when i create a pivot, save the file and open it again in the spire.spreadsheet
the pivot table is not shown.
If I open the file with excel, the pivot data are shown.
if I save the excelfile and open the file with spire.spreadsheet, then the pivot is shown.
could you please help me?
GH
sub CreateData
Dim workbook As New Workbook()
workbook.CreateEmptySheets(1)
Dim sheet As Worksheet = workbook.Worksheets(0)
sheet.Name = "Data"
'Set value of specified cell
sheet.Range("A1").Value = "KW"
sheet.Range("A2").NumberValue = 3
sheet.Range("A3").NumberValue = 2
sheet.Range("A4").NumberValue = 4
sheet.Range("A5").NumberValue = 4
sheet.Range("B1").Value = "Wert"
sheet.Range("B2").NumberValue = 3300
sheet.Range("B3").NumberValue = 2300
sheet.Range("B4").NumberValue = 4500
sheet.Range("B5").NumberValue = 6700
Dim DataRange As CellRange = sheet.Range("A1:B17")
Dim cache As PivotCache = workbook.PivotCaches.Add(DataRange)
Dim Tempsheet As Worksheet = workbook.CreateEmptySheet
Tempsheet.Name = "Pivot"
Dim pt As PivotTable = Tempsheet.PivotTables.Add("Pivot Table", Tempsheet.Range("A1"), cache)
Dim r1 = pt.PivotFields("KW")
r1.Axis = AxisTypes.Row
pt.Options.RowHeaderCaption = "KW"
pt.DataFields.Add(pt.PivotFields("Wert"), "Wert", SubtotalTypes.Sum)
pt.BuiltInStyle = PivotBuiltInStyles.PivotStyleMedium12
workbook.CalculateAllValue()
workbook.SaveToFile(FieName, ExcelVersion.Version2010)
Spreadsheet1.LoadFromFile(FieName)
End Sub