[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotFilter.WholeDayFilter

WholeDayFilter Property

WholeDayFilter

Gets or sets whether the date filter uses whole days in its filtering criteria.

When this property is true, the filter evaluates date values by whole day instead of by their time components. Changes to this setting do not refresh the current PivotTable automatically. Call Update() or Refresh() after changing the filter configuration if you need the displayed filter results to be updated.

Declaration
bool WholeDayFilter { get; set; }
Property WholeDayFilter As Boolean
Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Date", "Amount"},
    {new DateTime(2024, 1, 1), 100},
    {new DateTime(2024, 1, 1, 15, 30, 0), 200},
    {new DateTime(2024, 1, 2), 300}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:B4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["D1"], "pivotTable1");
IPivotField dateField = pivotTable.PivotFields["Date"];
dateField.Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotFilter filter = dateField.PivotFilters.Add(
    PivotFilterType.DateBetween,
    new DateTime(2024, 1, 1),
    new DateTime(2024, 1, 1, 23, 59, 59)
);
bool wholeDayFilter = filter.WholeDayFilter;