diff --git a/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs b/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs index e1c4a73..9b35733 100644 --- a/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs +++ b/ClosedXML/Excel/PivotTables/PivotValues/XLPivotValues.cs @@ -1,11 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace ClosedXML.Excel { - internal class XLPivotValues: IXLPivotValues + internal class XLPivotValues : IXLPivotValues { private readonly Dictionary _pivotValues = new Dictionary(); @@ -30,6 +29,7 @@ { return Add(sourceName, sourceName); } + public IXLPivotValue Add(String sourceName, String customName) { if (sourceName != XLConstants.PivotTableValuesSentinalLabel && !this._pivotTable.SourceRangeFieldsAvailable.Contains(sourceName, StringComparer.OrdinalIgnoreCase)) @@ -48,6 +48,7 @@ { _pivotValues.Clear(); } + public void Remove(String sourceName) { _pivotValues.Remove(sourceName); diff --git a/ClosedXML/Excel/XLWorkbook.cs b/ClosedXML/Excel/XLWorkbook.cs index 20ca064..84b2f6b 100644 --- a/ClosedXML/Excel/XLWorkbook.cs +++ b/ClosedXML/Excel/XLWorkbook.cs @@ -41,7 +41,7 @@ Simple = 1, } - public partial class XLWorkbook: IXLWorkbook + public partial class XLWorkbook : IXLWorkbook { #region Static @@ -123,14 +123,14 @@ Scale = 100, PaperSize = XLPaperSize.LetterPaper, Margins = new XLMargins - { - Top = 0.75, - Bottom = 0.5, - Left = 0.75, - Right = 0.75, - Header = 0.5, - Footer = 0.75 - }, + { + Top = 0.75, + Bottom = 0.5, + Left = 0.75, + Right = 0.75, + Header = 0.5, + Footer = 0.75 + }, ScaleHFWithDocument = true, AlignHFWithMargins = true, PrintErrorValue = XLPrintErrorValues.Displayed, @@ -190,7 +190,7 @@ return _stylesById[id]; } - #region Nested Type: XLLoadSource + #region Nested Type: XLLoadSource private enum XLLoadSource { @@ -704,7 +704,7 @@ } } -#region Fields + #region Fields private XLLoadSource _loadSource = XLLoadSource.New; private String _originalFile; @@ -712,13 +712,13 @@ #endregion Fields -#region Constructor + #region Constructor /// /// Creates a new Excel workbook. /// public XLWorkbook() - :this(XLEventTracking.Enabled) + : this(XLEventTracking.Enabled) { } @@ -779,7 +779,7 @@ /// Opens an existing workbook from a stream. /// /// The stream to open. - public XLWorkbook(Stream stream):this(stream, XLEventTracking.Enabled) + public XLWorkbook(Stream stream) : this(stream, XLEventTracking.Enabled) { } @@ -793,7 +793,7 @@ #endregion Constructor -#region Nested type: UnsupportedSheet + #region Nested type: UnsupportedSheet internal sealed class UnsupportedSheet { @@ -995,10 +995,13 @@ { case XLLoadSource.New: return "XLWorkbook(new)"; + case XLLoadSource.File: return String.Format("XLWorkbook({0})", _originalFile); + case XLLoadSource.Stream: return String.Format("XLWorkbook({0})", _originalStream.ToString()); + default: throw new NotImplementedException(); }