Excel Pivot-table 聚合的性能
Excel performance on Pivot-table aggregations
在我使用 Excel 时,我总是对 Excel 执行以下两个聚合操作的效果感到惊讶:
- Date/Time 聚合。
- 不区分大小写的聚合。
Excel 是如何实现这种性能的?他们是否为数据透视相关的信息和聚合存储额外的数据结构?这是否记录在任何地方或我在哪里可以找到更多相关信息?我查看了 Libreoffice 源代码,但实际产品在 aggregation/pivot 性能上什至不接近 Excel。
如果了解 Excel 的人可以分享更多有关 Excel 用于实现此性能的低级聚合行为或结构的信息,那就太好了——例如,它们是将任何标签存储两次——一次是在其原始情况下,一次是为了聚合目的而降低?虽然我知道这个问题过于宽泛而不是关于代码答案本身,而且它更概念化,但我希望这个答案可以作为优化 excel 式聚合性能的方法的良好参考。
以下是我根据 ARGeo 的一些建议注意到的一些事情 --
(1) 有两个与 Pivot Cache 相关的文件 -- Definitions (field-level info):
(2) 和记录 (row/cell 级别信息) --
接下来的几个问题:
- Excel 如何确定何时按原样存储值以及何时将其存储为共享记录。例如,为什么 B2 中的值 "LifeLock"(混合大小写的字符串)按原样存储,但 F2 中的值 "AZ" 存储为 sharedItems (v="0")?
- 是否有任何关于内部 C/C++
Struct
的信息 Excel 在内存中使用其 pivotCache(而不是各种 XML 文档存储)?
- 是否有关于Excel如何在字段级存储的"helper information"的信息?例如,此信息:
.
<cacheField name="numEmps" numFmtId="0"><sharedItems containsString="0" containsBlank="1" containsNumber="1" containsInteger="1" minValue="0" maxValue="20000"/></cacheField>
Pivot-table 性能基于 Pivot Cache
。虽然关于这个主题的信息很少(我的意思是缺少官方文档),但我发现了一些有趣的帖子和 MS 文档。
定义:
Pivot Cache
是一个特殊的内存区域,其中保存pivottable条记录.
When you create a Pivot Table
, Excel takes a copy of the source data and stores it in the Pivot Cache
. The Pivot Cache
is held in Excel’s memory. You can’t see it but that’s the data the Pivot Table references when you build your Pivot Table.
This enables Excel to be very responsive to changes in the Pivot Table but it can also double the size of your file
. After all, the Pivot Cache is just a duplicate of your source data so it makes sense that your file size will potentially double.
请使用此 link and this link 作为起始参考点以获取更多信息。
此外,您可以阅读 Pivot Cache in Excel 101 and Excel Pivot Cache 101 篇文章以了解它是什么以及它有什么副作用。
这里有一些 VB 代码片段和示例如何使用 PivotCache object。
这是一个用 C# 编写的代码,它允许您使用一些 Pivot Tables
创建一个 Excel 工作簿,当然,使用 Pivot Cache
:
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Excel = Microsoft.Office.Interop.Excel;
using System.IO;
using System.Diagnostics;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Excel.Application objApp;
Excel.Workbook objBook;
Excel.Sheets objSheets;
Excel.Workbooks objBooks;
string command = (@"SELECT * FROM dbo.Client");
using (SqlConnection connection = new SqlConnection(GetConnectionStringByName("CubsPlus"))) {
DataTable data = new DataTable();
try {
connection.Open();
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
Console.WriteLine (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
try {
data = DataTools.SQLQueries.getDataTableFromQuery(connection, command);
if (data == null) {
throw new ArgumentNullException();
}
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
Console.WriteLine (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
objApp = new Excel.Application();
try {
objBooks = objApp.Workbooks;
objBook = objApp.Workbooks.Add(Missing.Value);
objSheets = objBook.Worksheets;
Excel.Worksheet sheet1 = (Excel.Worksheet)objSheets[1];
sheet1.Name = "ACCOUNTS";
string message = DataTools.Excel.copyDataTableToExcelSheet(data, sheet1);
if (message != null) {
Console.WriteLine("Problem importing the data to Excel");
Console.WriteLine(message);
Console.ReadLine();
}
//CREATE A PIVOT CACHE BASED ON THE EXPORTED DATA
Excel.PivotCache pivotCache = objBook.PivotCaches().Add(Excel.XlPivotTableSourceType.xlDatabase,sheet1.UsedRange);
Console.WriteLine(pivotCache.SourceData.ToString());
Console.ReadLine();
//WORKSHEET FOR NEW PIVOT TABLE
Excel.Worksheet sheet2 = (Excel.Worksheet)objSheets[2];
sheet2.Name = "PIVOT1";
//PIVOT TABLE BASED ON THE PIVOT CACHE OF EXPORTED DATA
Excel.PivotTables pivotTables = (Excel.PivotTables)sheet2.PivotTables(Missing.Value);
Excel.PivotTable pivotTable = pivotTables.Add(pivotCache, objApp.ActiveCell, "PivotTable1", Missing.Value, Missing.Value);
pivotTable.SmallGrid = false;
pivotTable.TableStyle = "PivotStyleLight1";
//ADDING PAGE FIELD
Excel.PivotField pageField = (Excel.PivotField)pivotTable.PivotFields("ParentName");
pageField.Orientation = Excel.XlPivotFieldOrientation.xlPageField;
//ADDING ROW FIELD
Excel.PivotField rowField = (Excel.PivotField)pivotTable.PivotFields("State");
rowField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
//ADDING DATA FIELD
pivotTable.AddDataField(pivotTable.PivotFields("SetupDate"), "average setup date", Excel.XlConsolidationFunction.xlAverage);
ExcelSaveAs(objApp, objBook, @"J:\WBK");
objApp.Quit();
}
catch (Exception e) {
objApp.Quit();
Console.WriteLine(e.Message);
Console.ReadLine();
}
}
}
static string ExcelSaveAs(Excel.Application objApp, Excel.Workbook objBook, string path) {
try {
objApp.DisplayAlerts = false;
objBook.SaveAs(path, Excel.XlFileFormat.xlExcel7, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
objApp.DisplayAlerts = true;
return null;
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
return (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
}
static string GetConnectionStringByName(string name) {
//ASSUME FAILURE
string returnValue = null;
//Look for the name in the connectionStrings section
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[name];
// If found, return the connection string
if (settings != null) {
returnValue = settings.ConnectionString;
}
return returnValue;
}
}
}
这是一个用 VB 编写的代码,它允许我们为选定的 Pivot Table
创建一个新的 Pivot Cache
:
Sub SelPTNewCache()
Dim wsTemp As Worksheet
Dim pt As PivotTable
On Error Resume Next
Set pt = ActiveCell.PivotTable
If pt Is Nothing Then
MsgBox "Active cell is not in a pivot table"
Else
Set wsTemp = Worksheets.Add
ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=pt.SourceData).CreatePivotTable _
TableDestination:=wsTemp.Range("A3"), _
TableName:="PivotTableTemp"
pt.CacheIndex = wsTemp.PivotTables(1).CacheIndex
Application.DisplayAlerts = False
wsTemp.Delete
Application.DisplayAlerts = True
End If
exitHandler:
Set pt = Nothing
End Sub
1. In your asd.js
file there are the following elements:
– s
代表一个字符串值
– n
代表一个数值
– d
代表一个日期值
– x
代表一个索引值
– v
表示一个值本身
所以,让我们用人类语言翻译这个table的F2
单元格中包含的数据:
<x v="0"/>
0
的值是一个 zero index
字符串数组,其中存储了美国各州的缩写。该数组中的第一个索引为我们检索 Arizona
。我不知道为什么下一行的单元格包含小写 az
而所有其他单元格包含大写 AZ
但我确定这与 Shared Record
.
无关
2. I haven't found any useful information on the internal C/C++ Struct that Excel uses in-memory for its pivotCache.
最后:
3. Here's a LINK containing useful info regarding "helper information" in third extra question.
P.S.
关于大 O 表示法。
Big O notation is used in Computer Science to describe the performance or complexity of an algorithm. Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (in memory or on disk) by an algorithm. Big O notation
is a measure of the complexity of your program in terms of the size of the input.
O(1)
代表无论输入数据集的大小总是同时执行的算法。
O(N)
代表算法性能线性增长,与输入数据集的大小成正比。
O(N*N)
表示性能与输入数据集大小的平方成正比的算法。
T(N) = O(log N)
表示性能依赖于对数时间的算法。采用对数时间的算法常见于 binary trees 上的操作或使用二进制搜索时。
但是好的排序算法是苛刻的O(N log N)
。具有这种效率的算法示例可以是 merge sort,它 将数组分成两半,通过递归调用自身对这两半进行排序, 然后将结果合并回一个数组.
这是一个抽象的 C# 代码片段,展示了 O(N log N)
算法的工作原理(大致相同的方法可用于创建枢轴 table):
public static int[] MergeSort(int[] inputItems, int lowerBound, int upperBound) {
if (lowerBound < upperBound) {
int middle = (lowerBound + upperBound) / 2;
MergeSort(inputItems, lowerBound, middle);
MergeSort(inputItems, middle + 1, upperBound);
int[] leftArray = new int[middle - lowerBound + 1];
int[] rightArray = new int[upperBound - middle];
Array.Copy(inputItems, lowerBound, leftArray, 0, middle - lowerBound + 1);
Array.Copy(inputItems, middle + 1, rightArray, 0, upperBound - middle);
int i = 0;
int j = 0;
for (int count = lowerBound; count < upperBound + 1; count++) {
if (i == leftArray.Length) {
inputItems[count] = rightArray[j];
j++;
}
else if (j == rightArray.Length) {
inputItems[count] = leftArray[i];
i++;
}
else if (leftArray[i] <= rightArray[j]) {
inputItems[count] = leftArray[i];
i++;
}
else {
inputItems[count] = rightArray[j];
j++;
}
}
}
return inputItems;
}
- 枢轴 table 与流行的看法形成对比,而不仅仅是 Excel
功能,但存在于许多处理表格的应用程序中
结构化数值数据 - pivot tables 是视觉和
数据聚合的一般概念的交互结果取决于
关于类别。
- 数据透视表 Table 始终链接到它们的来源数据。
- 创建 Pivot 时 table Excel 构建特殊的内存缓存
在后台包含您的数据。这个枢轴缓存存储一个
源数据范围内数据的副本。
- Pivot table 如果它们引用相同的源则共享一个 pivot 缓存
数据范围。这有助于减小文件大小并防止我们拥有
刷新共享相同源数据范围的每个数据透视表 table。
- 枢轴table与枢轴缓存的关系可以得到
复杂的。特别是因为数据透视缓存存储在
背景,并且无法查看共享的数据透视表 table
工作簿中的数据透视缓存。
PivotCache Class PivotCache.When对象被序列化为
xml,其限定名称为x:pivotCache.
PivotCache Members (Excel)表示内存缓存为a
数据透视表Table 报告。
表示一个基class,一个Office Open XML中的所有元素
文档派生自。
OpenXML specification是一头庞大而复杂的野兽。
cacheField (PivotCache Field)表示
数据透视缓存。此定义包含有关字段的信息,
例如它的来源、数据类型和在一个级别中的位置或
等级制度。 sharedItems 元素存储附加信息
关于该字段中的数据。如果没有共享项,则
值直接存储在 pivotCacheRecords 部分。
定义SharedItems Class。当对象被序列出时
作为 xml,其限定名称为 x:sharedItems.
- How do update pivot table datafrom C# code
- Use C++ to show memory use in an Excel Pivot table
- How to create excel pivot table from C++ (ole/com without mfc)
- How to Create Pivot Table in Excel in C#.NET Code
- 如何将数据导出到一个工作表并在其中创建数据透视表 Table
另一个基于数据
- How to add PivotTables and Slicers to MS Excel programmatically
在我使用 Excel 时,我总是对 Excel 执行以下两个聚合操作的效果感到惊讶:
- Date/Time 聚合。
- 不区分大小写的聚合。
Excel 是如何实现这种性能的?他们是否为数据透视相关的信息和聚合存储额外的数据结构?这是否记录在任何地方或我在哪里可以找到更多相关信息?我查看了 Libreoffice 源代码,但实际产品在 aggregation/pivot 性能上什至不接近 Excel。
如果了解 Excel 的人可以分享更多有关 Excel 用于实现此性能的低级聚合行为或结构的信息,那就太好了——例如,它们是将任何标签存储两次——一次是在其原始情况下,一次是为了聚合目的而降低?虽然我知道这个问题过于宽泛而不是关于代码答案本身,而且它更概念化,但我希望这个答案可以作为优化 excel 式聚合性能的方法的良好参考。
以下是我根据 ARGeo 的一些建议注意到的一些事情 --
(1) 有两个与 Pivot Cache 相关的文件 -- Definitions (field-level info):
(2) 和记录 (row/cell 级别信息) --
接下来的几个问题:
- Excel 如何确定何时按原样存储值以及何时将其存储为共享记录。例如,为什么 B2 中的值 "LifeLock"(混合大小写的字符串)按原样存储,但 F2 中的值 "AZ" 存储为 sharedItems (v="0")?
- 是否有任何关于内部 C/C++
Struct
的信息 Excel 在内存中使用其 pivotCache(而不是各种 XML 文档存储)? - 是否有关于Excel如何在字段级存储的"helper information"的信息?例如,此信息:
.
<cacheField name="numEmps" numFmtId="0"><sharedItems containsString="0" containsBlank="1" containsNumber="1" containsInteger="1" minValue="0" maxValue="20000"/></cacheField>
Pivot-table 性能基于 Pivot Cache
。虽然关于这个主题的信息很少(我的意思是缺少官方文档),但我发现了一些有趣的帖子和 MS 文档。
定义:
Pivot Cache
是一个特殊的内存区域,其中保存pivottable条记录.
When you create a
Pivot Table
, Excel takes a copy of the source data and stores it in thePivot Cache
. ThePivot Cache
is held in Excel’s memory. You can’t see it but that’s the data the Pivot Table references when you build your Pivot Table.
This enables Excel to be very responsive to changes in the Pivot Table but it can also double the size of your file
. After all, the Pivot Cache is just a duplicate of your source data so it makes sense that your file size will potentially double.
请使用此 link and this link 作为起始参考点以获取更多信息。
此外,您可以阅读 Pivot Cache in Excel 101 and Excel Pivot Cache 101 篇文章以了解它是什么以及它有什么副作用。
这里有一些 VB 代码片段和示例如何使用 PivotCache object。
这是一个用 C# 编写的代码,它允许您使用一些 Pivot Tables
创建一个 Excel 工作簿,当然,使用 Pivot Cache
:
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Excel = Microsoft.Office.Interop.Excel;
using System.IO;
using System.Diagnostics;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Excel.Application objApp;
Excel.Workbook objBook;
Excel.Sheets objSheets;
Excel.Workbooks objBooks;
string command = (@"SELECT * FROM dbo.Client");
using (SqlConnection connection = new SqlConnection(GetConnectionStringByName("CubsPlus"))) {
DataTable data = new DataTable();
try {
connection.Open();
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
Console.WriteLine (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
try {
data = DataTools.SQLQueries.getDataTableFromQuery(connection, command);
if (data == null) {
throw new ArgumentNullException();
}
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
Console.WriteLine (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
objApp = new Excel.Application();
try {
objBooks = objApp.Workbooks;
objBook = objApp.Workbooks.Add(Missing.Value);
objSheets = objBook.Worksheets;
Excel.Worksheet sheet1 = (Excel.Worksheet)objSheets[1];
sheet1.Name = "ACCOUNTS";
string message = DataTools.Excel.copyDataTableToExcelSheet(data, sheet1);
if (message != null) {
Console.WriteLine("Problem importing the data to Excel");
Console.WriteLine(message);
Console.ReadLine();
}
//CREATE A PIVOT CACHE BASED ON THE EXPORTED DATA
Excel.PivotCache pivotCache = objBook.PivotCaches().Add(Excel.XlPivotTableSourceType.xlDatabase,sheet1.UsedRange);
Console.WriteLine(pivotCache.SourceData.ToString());
Console.ReadLine();
//WORKSHEET FOR NEW PIVOT TABLE
Excel.Worksheet sheet2 = (Excel.Worksheet)objSheets[2];
sheet2.Name = "PIVOT1";
//PIVOT TABLE BASED ON THE PIVOT CACHE OF EXPORTED DATA
Excel.PivotTables pivotTables = (Excel.PivotTables)sheet2.PivotTables(Missing.Value);
Excel.PivotTable pivotTable = pivotTables.Add(pivotCache, objApp.ActiveCell, "PivotTable1", Missing.Value, Missing.Value);
pivotTable.SmallGrid = false;
pivotTable.TableStyle = "PivotStyleLight1";
//ADDING PAGE FIELD
Excel.PivotField pageField = (Excel.PivotField)pivotTable.PivotFields("ParentName");
pageField.Orientation = Excel.XlPivotFieldOrientation.xlPageField;
//ADDING ROW FIELD
Excel.PivotField rowField = (Excel.PivotField)pivotTable.PivotFields("State");
rowField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
//ADDING DATA FIELD
pivotTable.AddDataField(pivotTable.PivotFields("SetupDate"), "average setup date", Excel.XlConsolidationFunction.xlAverage);
ExcelSaveAs(objApp, objBook, @"J:\WBK");
objApp.Quit();
}
catch (Exception e) {
objApp.Quit();
Console.WriteLine(e.Message);
Console.ReadLine();
}
}
}
static string ExcelSaveAs(Excel.Application objApp, Excel.Workbook objBook, string path) {
try {
objApp.DisplayAlerts = false;
objBook.SaveAs(path, Excel.XlFileFormat.xlExcel7, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
objApp.DisplayAlerts = true;
return null;
}
catch (Exception e) {
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
return (e.Message + "\n" + "Method" + sf.GetMethod().ToString() + "\n" + "Line" + sf.GetFileLineNumber().ToString());
}
}
static string GetConnectionStringByName(string name) {
//ASSUME FAILURE
string returnValue = null;
//Look for the name in the connectionStrings section
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings[name];
// If found, return the connection string
if (settings != null) {
returnValue = settings.ConnectionString;
}
return returnValue;
}
}
}
这是一个用 VB 编写的代码,它允许我们为选定的 Pivot Table
创建一个新的 Pivot Cache
:
Sub SelPTNewCache()
Dim wsTemp As Worksheet
Dim pt As PivotTable
On Error Resume Next
Set pt = ActiveCell.PivotTable
If pt Is Nothing Then
MsgBox "Active cell is not in a pivot table"
Else
Set wsTemp = Worksheets.Add
ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=pt.SourceData).CreatePivotTable _
TableDestination:=wsTemp.Range("A3"), _
TableName:="PivotTableTemp"
pt.CacheIndex = wsTemp.PivotTables(1).CacheIndex
Application.DisplayAlerts = False
wsTemp.Delete
Application.DisplayAlerts = True
End If
exitHandler:
Set pt = Nothing
End Sub
1. In your
asd.js
file there are the following elements:
– s
代表一个字符串值
– n
代表一个数值
– d
代表一个日期值
– x
代表一个索引值
– v
表示一个值本身
所以,让我们用人类语言翻译这个table的F2
单元格中包含的数据:
<x v="0"/>
0
的值是一个 zero index
字符串数组,其中存储了美国各州的缩写。该数组中的第一个索引为我们检索 Arizona
。我不知道为什么下一行的单元格包含小写 az
而所有其他单元格包含大写 AZ
但我确定这与 Shared Record
.
2. I haven't found any useful information on the internal C/C++ Struct that Excel uses in-memory for its pivotCache.
最后:
3. Here's a LINK containing useful info regarding "helper information" in third extra question.
P.S.
关于大 O 表示法。
Big O notation is used in Computer Science to describe the performance or complexity of an algorithm. Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (in memory or on disk) by an algorithm.
Big O notation
is a measure of the complexity of your program in terms of the size of the input.
O(1)
代表无论输入数据集的大小总是同时执行的算法。O(N)
代表算法性能线性增长,与输入数据集的大小成正比。O(N*N)
表示性能与输入数据集大小的平方成正比的算法。T(N) = O(log N)
表示性能依赖于对数时间的算法。采用对数时间的算法常见于 binary trees 上的操作或使用二进制搜索时。
但是好的排序算法是苛刻的O(N log N)
。具有这种效率的算法示例可以是 merge sort,它 将数组分成两半,通过递归调用自身对这两半进行排序, 然后将结果合并回一个数组.
这是一个抽象的 C# 代码片段,展示了 O(N log N)
算法的工作原理(大致相同的方法可用于创建枢轴 table):
public static int[] MergeSort(int[] inputItems, int lowerBound, int upperBound) {
if (lowerBound < upperBound) {
int middle = (lowerBound + upperBound) / 2;
MergeSort(inputItems, lowerBound, middle);
MergeSort(inputItems, middle + 1, upperBound);
int[] leftArray = new int[middle - lowerBound + 1];
int[] rightArray = new int[upperBound - middle];
Array.Copy(inputItems, lowerBound, leftArray, 0, middle - lowerBound + 1);
Array.Copy(inputItems, middle + 1, rightArray, 0, upperBound - middle);
int i = 0;
int j = 0;
for (int count = lowerBound; count < upperBound + 1; count++) {
if (i == leftArray.Length) {
inputItems[count] = rightArray[j];
j++;
}
else if (j == rightArray.Length) {
inputItems[count] = leftArray[i];
i++;
}
else if (leftArray[i] <= rightArray[j]) {
inputItems[count] = leftArray[i];
i++;
}
else {
inputItems[count] = rightArray[j];
j++;
}
}
}
return inputItems;
}
- 枢轴 table 与流行的看法形成对比,而不仅仅是 Excel 功能,但存在于许多处理表格的应用程序中 结构化数值数据 - pivot tables 是视觉和 数据聚合的一般概念的交互结果取决于 关于类别。
- 数据透视表 Table 始终链接到它们的来源数据。
- 创建 Pivot 时 table Excel 构建特殊的内存缓存 在后台包含您的数据。这个枢轴缓存存储一个 源数据范围内数据的副本。
- Pivot table 如果它们引用相同的源则共享一个 pivot 缓存 数据范围。这有助于减小文件大小并防止我们拥有 刷新共享相同源数据范围的每个数据透视表 table。
- 枢轴table与枢轴缓存的关系可以得到 复杂的。特别是因为数据透视缓存存储在 背景,并且无法查看共享的数据透视表 table 工作簿中的数据透视缓存。
PivotCache Class PivotCache.When对象被序列化为 xml,其限定名称为x:pivotCache.
PivotCache Members (Excel)表示内存缓存为a 数据透视表Table 报告。
表示一个基class,一个Office Open XML中的所有元素 文档派生自。
OpenXML specification是一头庞大而复杂的野兽。
cacheField (PivotCache Field)表示 数据透视缓存。此定义包含有关字段的信息, 例如它的来源、数据类型和在一个级别中的位置或 等级制度。 sharedItems 元素存储附加信息 关于该字段中的数据。如果没有共享项,则 值直接存储在 pivotCacheRecords 部分。
定义SharedItems Class。当对象被序列出时 作为 xml,其限定名称为 x:sharedItems.
- How do update pivot table datafrom C# code
- Use C++ to show memory use in an Excel Pivot table
- How to create excel pivot table from C++ (ole/com without mfc)
- How to Create Pivot Table in Excel in C#.NET Code
- 如何将数据导出到一个工作表并在其中创建数据透视表 Table 另一个基于数据
- How to add PivotTables and Slicers to MS Excel programmatically