Open yangmijun opened 2 days ago
HelloWorld.xlsx This is sample file
`static void Main(string[] args) { ExcelPackage.LicenseContext = LicenseContext.NonCommercial; using (var package = new ExcelPackage("HelloWorld.xlsx")) { var dataSheet = package.Workbook.Worksheets["Data"]; var pivotSheet = package.Workbook.Worksheets["Pivot"];
//create pivot table
var pivotDataRange = dataSheet.Cells[4, 2, 14, 8];
var pivotTable = pivotSheet.PivotTables.Add(pivotSheet.Cells["C3"], pivotDataRange, "TestPivotTable");
foreach (var field in pivotTable.Fields)
{
if (field != null)
{
Console.WriteLine(field.Name);
}
}
package.Save();
}
}` This is sample code.
The output would be: OfficeOpenXml.Style.ExcelRichTextCollection OfficeOpenXml.Style.ExcelRichTextCollection TimelEng 时间 Number String 字符串
EPPlus usage
Noncommercial use
Environment
Windows 10
Epplus version
7.4.2
Spreadsheet application
Excel
Description
Use EPPlus to open existing xlsx file, then create pivot table. then output all the field name in the pivottable, sometimes the field name will output "OfficeOpenXml.Style.ExcelRichTextCollection". The .xlsx file is edited by Excel, and I added some title style, and some title has Chinese charecter. This issue will stop me from getting some pivotfield by name.