diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotField.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotField.cs index 26336ec..c186c55 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotField.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotField.cs @@ -21,7 +21,7 @@ Variance, PopulationVariance, } - public enum XLLabelForm { Outline, Tabular } + public enum XLPivotLayout { Outline, Tabular, Compact } public interface IXLPivotField { String SourceName { get; } @@ -30,8 +30,7 @@ XLSubtotalFunction Subtotals { get; set; } Boolean IncludeNewItemsInFilter { get; set; } - XLLabelForm ItemLabelsForm { get; set; } - Boolean CompactForm { get; set; } + XLPivotLayout Layout { get; set; } Boolean SubtotalsAtTop { get; set; } Boolean RepeatItemLabels { get; set; } Boolean InsertBlankLines { get; set; } @@ -43,8 +42,7 @@ IXLPivotField SetSubtotals(XLSubtotalFunction value); IXLPivotField SetIncludeNewItemsInFilter(); IXLPivotField SetIncludeNewItemsInFilter(Boolean value); - IXLPivotField SetItemLabelsForm(XLLabelForm value); - IXLPivotField SetCompactForm(); IXLPivotField SetCompactForm(Boolean value); + IXLPivotField SetLayout(XLPivotLayout value); IXLPivotField SetSubtotalsAtTop(); IXLPivotField SetSubtotalsAtTop(Boolean value); IXLPivotField SetRepeatItemLabels(); IXLPivotField SetRepeatItemLabels(Boolean value); IXLPivotField SetInsertBlankLines(); IXLPivotField SetInsertBlankLines(Boolean value); diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotTable.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotTable.cs index a79ec3c..913fdc2 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotTable.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/IXLPivotTable.cs @@ -1,15 +1,110 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace ClosedXML.Excel { + public enum XLPivotTableTheme + { + PivotStyleDark1, + PivotStyleDark10, + PivotStyleDark11, + PivotStyleDark12, + PivotStyleDark13, + PivotStyleDark14, + PivotStyleDark15, + PivotStyleDark16, + PivotStyleDark17, + PivotStyleDark18, + PivotStyleDark19, + PivotStyleDark2, + PivotStyleDark20, + PivotStyleDark21, + PivotStyleDark22, + PivotStyleDark23, + PivotStyleDark24, + PivotStyleDark25, + PivotStyleDark26, + PivotStyleDark27, + PivotStyleDark28, + PivotStyleDark3, + PivotStyleDark4, + PivotStyleDark5, + PivotStyleDark6, + PivotStyleDark7, + PivotStyleDark8, + PivotStyleDark9, + PivotStyleLight1, + PivotStyleLight10, + PivotStyleLight11, + PivotStyleLight12, + PivotStyleLight13, + PivotStyleLight14, + PivotStyleLight15, + PivotStyleLight16, + PivotStyleLight17, + PivotStyleLight18, + PivotStyleLight19, + PivotStyleLight2, + PivotStyleLight20, + PivotStyleLight21, + PivotStyleLight22, + PivotStyleLight23, + PivotStyleLight24, + PivotStyleLight25, + PivotStyleLight26, + PivotStyleLight27, + PivotStyleLight28, + PivotStyleLight3, + PivotStyleLight4, + PivotStyleLight5, + PivotStyleLight6, + PivotStyleLight7, + PivotStyleLight8, + PivotStyleLight9, + PivotStyleMedium1, + PivotStyleMedium10, + PivotStyleMedium11, + PivotStyleMedium12, + PivotStyleMedium13, + PivotStyleMedium14, + PivotStyleMedium15, + PivotStyleMedium16, + PivotStyleMedium17, + PivotStyleMedium18, + PivotStyleMedium19, + PivotStyleMedium2, + PivotStyleMedium20, + PivotStyleMedium21, + PivotStyleMedium22, + PivotStyleMedium23, + PivotStyleMedium24, + PivotStyleMedium25, + PivotStyleMedium26, + PivotStyleMedium27, + PivotStyleMedium28, + PivotStyleMedium3, + PivotStyleMedium4, + PivotStyleMedium5, + PivotStyleMedium6, + PivotStyleMedium7, + PivotStyleMedium8, + PivotStyleMedium9 + } + + public enum XLPivotSubtotals + { + DoNotShow, + AtTop, + AtBottom + } + public enum XLFilterAreaOrder { DownThenOver, OverThenDown } public enum XLItemsToRetain { Automatic, None, Max } public interface IXLPivotTable { + XLPivotTableTheme Theme { get; set; } + + IXLPivotFields Fields { get; } IXLPivotFields ReportFilters { get; } IXLPivotFields ColumnLabels { get; } IXLPivotFields RowLabels { get; } @@ -95,6 +190,21 @@ IXLPivotTable SetItemsToRetainPerField(XLItemsToRetain value); IXLPivotTable SetEnableCellEditing(); IXLPivotTable SetEnableCellEditing(Boolean value); + Boolean ShowRowHeaders { get; set; } + Boolean ShowColumnHeaders { get; set; } + Boolean ShowRowStripes { get; set; } + Boolean ShowColumnStripes { get; set; } + XLPivotSubtotals Subtotals { get; set; } + XLPivotLayout Layout { set; } + Boolean InsertBlankLines { set; } + + IXLPivotTable SetShowRowHeaders(); IXLPivotTable SetShowRowHeaders(Boolean value); + IXLPivotTable SetShowColumnHeaders(); IXLPivotTable SetShowColumnHeaders(Boolean value); + IXLPivotTable SetShowRowStripes(); IXLPivotTable SetShowRowStripes(Boolean value); + IXLPivotTable SetShowColumnStripes(); IXLPivotTable SetShowColumnStripes(Boolean value); + IXLPivotTable SetSubtotals(XLPivotSubtotals value); + IXLPivotTable SetLayout(XLPivotLayout value); + IXLPivotTable SetInsertBlankLines(); IXLPivotTable SetInsertBlankLines(Boolean value); } diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotField.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotField.cs index eb345f5..2d22830 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotField.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotField.cs @@ -19,8 +19,7 @@ public XLSubtotalFunction Subtotals { get; set; } public IXLPivotField SetSubtotals(XLSubtotalFunction value) { Subtotals = value; return this; } public Boolean IncludeNewItemsInFilter { get; set; } public IXLPivotField SetIncludeNewItemsInFilter() { IncludeNewItemsInFilter = true; return this; } public IXLPivotField SetIncludeNewItemsInFilter(Boolean value) { IncludeNewItemsInFilter = value; return this; } - public XLLabelForm ItemLabelsForm { get; set; } public IXLPivotField SetItemLabelsForm(XLLabelForm value) { ItemLabelsForm = value; return this; } - public Boolean CompactForm { get; set; } public IXLPivotField SetCompactForm() { CompactForm = true; return this; } public IXLPivotField SetCompactForm(Boolean value) { CompactForm = value; return this; } + public XLPivotLayout Layout { get; set; } public IXLPivotField SetLayout(XLPivotLayout value) { Layout = value; return this; } public Boolean SubtotalsAtTop { get; set; } public IXLPivotField SetSubtotalsAtTop() { SubtotalsAtTop = true; return this; } public IXLPivotField SetSubtotalsAtTop(Boolean value) { SubtotalsAtTop = value; return this; } public Boolean RepeatItemLabels { get; set; } public IXLPivotField SetRepeatItemLabels() { RepeatItemLabels = true; return this; } public IXLPivotField SetRepeatItemLabels(Boolean value) { RepeatItemLabels = value; return this; } public Boolean InsertBlankLines { get; set; } public IXLPivotField SetInsertBlankLines() { InsertBlankLines = true; return this; } public IXLPivotField SetInsertBlankLines(Boolean value) { InsertBlankLines = value; return this; } diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotTable.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotTable.cs index f8bab9a..d848d31 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotTable.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/PivotTables/XLPivotTable.cs @@ -9,17 +9,21 @@ { public XLPivotTable() { + Fields = new XLPivotFields(); ReportFilters = new XLPivotFields(); ColumnLabels=new XLPivotFields(); RowLabels = new XLPivotFields(); Values = new XLPivotValues(); + Theme = XLPivotTableTheme.PivotStyleLight16; } + public IXLPivotFields Fields { get; private set; } public IXLPivotFields ReportFilters { get; private set; } public IXLPivotFields ColumnLabels { get; private set; } public IXLPivotFields RowLabels { get; private set; } public IXLPivotValues Values { get; private set; } + public XLPivotTableTheme Theme { get; set; } public IXLPivotTable SetTheme(XLPivotTableTheme value) { Theme = value; return this; } public String Name { get; set; } public IXLPivotTable SetName(String value) { Name = value; return this; } public String Title { get; set; } public IXLPivotTable SetTitle(String value) { Title = value; return this; } public String Description { get; set; } public IXLPivotTable SetDescription(String value) { Description = value; return this; } @@ -60,5 +64,26 @@ public XLItemsToRetain ItemsToRetainPerField { get; set; } public IXLPivotTable SetItemsToRetainPerField(XLItemsToRetain value) { ItemsToRetainPerField = value; return this; } public Boolean EnableCellEditing { get; set; } public IXLPivotTable SetEnableCellEditing() { EnableCellEditing = true; return this; } public IXLPivotTable SetEnableCellEditing(Boolean value) { EnableCellEditing = value; return this; } + + public Boolean ShowRowHeaders { get; set; } public IXLPivotTable SetShowRowHeaders() { ShowRowHeaders = true; return this; } public IXLPivotTable SetShowRowHeaders(Boolean value) { ShowRowHeaders = value; return this; } + public Boolean ShowColumnHeaders { get; set; } public IXLPivotTable SetShowColumnHeaders() { ShowColumnHeaders = true; return this; } public IXLPivotTable SetShowColumnHeaders(Boolean value) { ShowColumnHeaders = value; return this; } + public Boolean ShowRowStripes { get; set; } public IXLPivotTable SetShowRowStripes() { ShowRowStripes = true; return this; } public IXLPivotTable SetShowRowStripes(Boolean value) { ShowRowStripes = value; return this; } + public Boolean ShowColumnStripes { get; set; } public IXLPivotTable SetShowColumnStripes() { ShowColumnStripes = true; return this; } public IXLPivotTable SetShowColumnStripes(Boolean value) { ShowColumnStripes = value; return this; } + public XLPivotSubtotals Subtotals { get; set; } public IXLPivotTable SetSubtotals(XLPivotSubtotals value) { Subtotals = value; return this; } + + public XLPivotLayout Layout + { + set { Fields.ForEach(f=>f.SetLayout(value)); } + } + + public IXLPivotTable SetLayout(XLPivotLayout value) { Layout = value; return this; } + + public Boolean InsertBlankLines + { + set { Fields.ForEach(f=>f.SetInsertBlankLines(value)); } + } + + public IXLPivotTable SetInsertBlankLines() { InsertBlankLines = true; return this; } public IXLPivotTable SetInsertBlankLines(Boolean value) { InsertBlankLines = value; return this; } + } }