Skip to content

Commit dd53e38

Browse files
authored
Merge pull request #1615 from EPPlusSoftware/fix/comments-and-warings
Fixed several warnings
2 parents 3bfd7cc + 118ba8f commit dd53e38

23 files changed

+82
-38
lines changed

src/EPPlus/Drawing/Chart/ExcelManualLayout.cs

+24-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,29 @@ namespace OfficeOpenXml.Drawing.Chart
3232
/// </summary>
3333
public class ExcelManualLayout : XmlHelper
3434
{
35-
eLayoutTarget layoutTarget;
35+
//string _layoutTargetPath;
36+
//TODO: Check how this property should be added
37+
///// <summary>
38+
///// Layout target
39+
///// </summary>
40+
//public eLayoutTarget? LayoutTarget
41+
//{
42+
// get
43+
// {
44+
// return GetXmlEnumNull<eLayoutTarget>(_layoutTargetPath);
45+
// }
46+
// set
47+
// {
48+
// if ( value == null )
49+
// {
50+
// DeleteNode(_layoutTargetPath, true);
51+
// }
52+
// else
53+
// {
54+
// SetXmlNodeString(_layoutTargetPath, value.ToEnumString());
55+
// }
56+
// }
57+
//}
3658

3759
/// <summary>
3860
/// Define mode for Left (x) attribute
@@ -280,14 +302,10 @@ internal ExcelManualLayout(XmlNamespaceManager ns, XmlNode topNode, string path,
280302
{
281303
_path = path;
282304
_extLstPath = extLstPath;
305+
//_layoutTargetPath = $"{_path}/c:layoutTarget/@val"; Removed for now. See commented out property LayoutTarget above.
283306
NameSpaceManager.AddNamespace("c15", ExcelPackage.schemaChart2012);
284307
NameSpaceManager.AddNamespace("c16", ExcelPackage.schemaChart2014);
285308

286-
287-
//var extPath = "c:extLst/c:ext";
288-
//var extNode2 = GetNode($"{extPath}[1]");
289-
//var c15LayoutNode = (XmlElement)CreateNode(extNode2, "c15:layout");
290-
291309
AddSchemaNodeOrder(schemaNodeOrder, ["layoutTarget", "xMode", "yMode", "wMode", "hMode", "x", "y", "w", "h", "extLst"]);
292310
}
293311

src/EPPlus/Drawing/ExcelDrawing.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,14 @@ internal XmlElement CreateClientData()
13381338
return clientDataNode;
13391339
}
13401340

1341-
1341+
/// <summary>
1342+
/// Copies the drawing to the supplied worksheets. The copy will be positioned using the <paramref name="row"/> and <paramref name="col"/> parameters
1343+
/// </summary>
1344+
/// <param name="worksheet">The worksheet where the drawing will be placed.</param>
1345+
/// <param name="row">The top row where the drawing will be placed.</param>
1346+
/// <param name="col">The left column where the drawing will be placed.</param>
1347+
/// <param name="rowOffset">Row offset in pixels from the row start positions. int.MinValue </param>
1348+
/// <param name="colOffset">Column offset in pixels fromp the column start position</param>
13421349
public void Copy(ExcelWorksheet worksheet, int row, int col, int rowOffset = int.MinValue, int colOffset = int.MinValue)
13431350
{
13441351
XmlNode drawNode = null;

src/EPPlus/ExcelColumn.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public bool BestFit
169169
/// <summary>
170170
/// If the column is collapsed in outline mode.
171171
/// Setting this property will not hide the children.
172-
/// Use the <see cref="ExcelRangeColumn.CollapseChildren(bool)" /> or <see cref="ExcelRangeColumn.SetVisibleOutlineLevel(int, bool)"/> methods to collapse and hide columns/rows via the <see cref="ExcelWorksheet.Columns" collection/>.
172+
/// Use the <see cref="ExcelRangeColumn.CollapseChildren(bool)" /> or <see cref="ExcelRangeColumn.SetVisibleOutlineLevel(int, bool)"/> methods to collapse and hide columns/rows via the <see cref="ExcelWorksheet.Columns"/> collection.
173173
/// </summary>
174174
public bool Collapsed { get; set; }
175175
/// <summary>

src/EPPlus/ExcelRow.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public int Row
212212
/// <summary>
213213
/// If outline level is set this tells that the row is collapsed.
214214
/// Setting this property will not hide the children.
215-
/// Use the <see cref="ExcelRangeRow.CollapseChildren(bool)" /> or <see cref="ExcelRangeRow.SetVisibleOutlineLevel(int, bool)"/> methods to collapse and hide columns/rows via the <see cref="ExcelWorksheet.Rows" collection/>.
215+
/// Use the <see cref="ExcelRangeRow.CollapseChildren(bool)" /> or <see cref="ExcelRangeRow.SetVisibleOutlineLevel(int, bool)"/> methods to collapse and hide columns/rows via the <see cref="ExcelWorksheet.Rows"/> collection.
216216
/// </summary>
217217
public bool Collapsed
218218
{

src/EPPlus/Export/HtmlExport/Translators/CssTextFormatTranslator.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ internal class CssTextFormatTranslator : CssTableTextFormatTranslator
2222
bool _wrapText;
2323
int _indent;
2424
int _textRotation;
25-
bool _rightDefault;
2625

2726
internal CssTextFormatTranslator(StyleXml xfs) : base(xfs)
2827
{
@@ -33,7 +32,7 @@ internal CssTextFormatTranslator(StyleXml xfs) : base(xfs)
3332
_applyAlignment = xfs._style.ApplyAlignment;
3433

3534
_horizontalAlignment = xfs._style.HorizontalAlignment;
36-
_verticalAlignment = xfs._style.VerticalAlignment;
35+
_verticalAlignment = xfs._style.VerticalAlignment;
3736
}
3837

3938
internal override List<Declaration> GenerateDeclarationList(TranslatorContext context)
@@ -56,10 +55,6 @@ internal override List<Declaration> GenerateDeclarationList(TranslatorContext co
5655
vAlign = GetVerticalAlignment();
5756
}
5857

59-
if ((string.IsNullOrEmpty(hAlign)) && _rightDefault)
60-
{
61-
hAlign = "right";
62-
}
6358

6459
if ((string.IsNullOrEmpty(hAlign) == false) && (context.Exclude.HorizontalAlignment == false))
6560
{

src/EPPlus/FormulaParsing/LexicalAnalysis/FormulaAddress.cs

+3
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,9 @@ internal FormulaRangeAddress GetIntersectingRowOrColumns(FormulaRangeAddress add
935935
/// </summary>
936936
public FormulaRangeAddress Address => this;
937937

938+
/// <summary>
939+
/// If the address contains multiple comma separated addresses, the individual addresses are stored here.
940+
/// </summary>
938941
public FormulaRangeAddress[] Addresses => [this];
939942
}
940943
/// <summary>

src/EPPlus/FormulaParsing/Ranges/EpplusExcelExternalRangeInfo.cs

+3
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
284284

285285
public FormulaRangeAddress Address { get { return _address; } }
286286

287+
/// <summary>
288+
/// If the address contains multiple comma separated addresses, the individual addresses are stored here.
289+
/// </summary>
287290
public FormulaRangeAddress[] Addresses => [_address];
288291

289292
/// <summary>

src/EPPlus/FormulaParsing/Ranges/InMemoryRange.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ object IEnumerator.Current
187187
return _cells[_rowIndex, _colIx] ?? new InMemoryCellInfo(null);
188188
}
189189
}
190-
190+
/// <summary>
191+
/// The addresses for the range, if more than one.
192+
/// </summary>
191193
public FormulaRangeAddress[] Addresses => [_address];
192194

193195
/// <summary>

src/EPPlus/NumberFormatToTextArgs.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Date Author Change
1818
namespace OfficeOpenXml
1919
{
2020
/// <summary>
21-
/// Numberformat settings used in the <see cref=""/>
21+
/// Numberformat settings used in the <see cref="ExcelWorkbook.NumberFormatToTextHandler"/>
2222
/// </summary>
2323
public class NumberFormatToTextArgs
2424
{

src/EPPlus/Style/ExcelNumberFormat.cs

+5
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ internal static NumberFormatType GetNumberFormatType(string format)
266266
{
267267
continue;
268268
}
269+
else if(isText)
270+
{
271+
isText = false;
272+
continue;
273+
}
269274
switch(c)
270275
{
271276
case '\\':

src/EPPlus/Table/PivotTable/Calculation/PivotTableColumnCalculation.cs

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ internal class PivotTableColumnCalculation
3131
{
3232
ExcelPivotTable _tbl;
3333
List<PivotCalculationStore> _calcItems;
34-
List<int> _calcOrder;
3534
FormulaParser _formulaParser;
3635
FunctionRepository _fr;
3736
public PivotTableColumnCalculation(ExcelPivotTable tbl)

src/EPPlus/Table/PivotTable/ExcelPivotTable.cs

+19-7
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,27 @@ public override bool Equals(object obj)
5252
/// <summary>
5353
/// The hash value for the object
5454
/// </summary>
55-
/// <param name="obj"></param>
5655
/// <returns></returns>
57-
public int GetHashCode(PivotNull obj)
56+
public override int GetHashCode()
5857
{
5958
return 0;
6059
}
6160

62-
/// <summary>
63-
/// Return the string representation of the pivot null value
64-
/// </summary>
65-
/// <returns>An empty string</returns>
66-
public override string ToString()
61+
/// <summary>
62+
/// The hash value for the object
63+
/// </summary>
64+
/// <param name="obj"></param>
65+
/// <returns></returns>
66+
public int GetHashCode(PivotNull obj)
67+
{
68+
return 0;
69+
}
70+
71+
/// <summary>
72+
/// Return the string representation of the pivot null value
73+
/// </summary>
74+
/// <returns>An empty string</returns>
75+
public override string ToString()
6776
{
6877
return "";
6978
}
@@ -1622,6 +1631,9 @@ internal List<int> RowColumnFieldIndicies
16221631
}
16231632
}
16241633

1634+
/// <summary>
1635+
/// A collection of Conditional Formatting's to apply to the pivot table.
1636+
/// </summary>
16251637
public ExcelPivotTableConditionalFormattingCollection ConditionalFormattings { get; private set; }
16261638

16271639
internal int ChangeCacheId(int oldCacheId)

src/EPPlus/Table/PivotTable/PivotArea/ConditionalFormats/ExcelPivotTableAreaConditionalFormattingCollection.cs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class ExcelPivotTableAreaConditionalFormattingCollection : EPPlusReadOnly
2222
{
2323
readonly ExcelPivotTable _pt;
2424
readonly XmlNamespaceManager _nsm;
25-
readonly XmlNode _topNode;
2625
readonly XmlHelper _helper;
2726
internal ExcelPivotTableAreaConditionalFormattingCollection(ExcelPivotTable pt, XmlNode topNode)
2827
{

src/EPPlus/Table/PivotTable/PivotArea/ConditionalFormats/ExcelPivotTableConditionalFormattingCollection.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Date Author Change
1212
*************************************************************************************************/
1313
using OfficeOpenXml.ConditionalFormatting;
1414
using OfficeOpenXml.Core;
15+
using System;
16+
using System.Linq;
1517
using System.Xml;
1618
namespace OfficeOpenXml.Table.PivotTable
1719
{
@@ -38,9 +40,8 @@ internal ExcelPivotTableConditionalFormattingCollection(ExcelPivotTable pt)
3840
/// Note that only conditional formattings for data is support. Conditional formattings for Lables, data buttons and other pivot areas must be added using the <see cref="ExcelWorksheet.ConditionalFormatting" /> collection.
3941
/// </summary>
4042
/// <param name="ruleType">The type of conditional formatting rule</param>
41-
/// <param name="fields">The data field(cf) in the pivot table to apply the rule. If no data field is provided, all data field in the collection will be added to the area.The area will be added to the <see cref="ExcelPivotTableConditionalFormatting.Areas" collection/></param>
43+
/// <param name="fields">The data field(cf) in the pivot table to apply the rule. If no data field is provided, all data field in the collection will be added to the area.The area will be added to the <see cref="ExcelPivotTableConditionalFormatting.Areas" /> collection</param>
4244
/// <returns>The rule</returns>
43-
/// <exception cref="InvalidOperationException">If no data fields exist in the data fields collection.</exception>
4445
public ExcelPivotTableConditionalFormatting Add(eExcelPivotTableConditionalFormattingRuleType ruleType, params ExcelPivotTableDataField[] fields)
4546
{
4647
var cfFormatNode = GetTopNode();

src/EPPlus/Utils/InvariantObjectComparer.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public int GetHashCode(object obj)
4141
{
4242
return GetValueToCompare(obj).GetHashCode();
4343
}
44-
44+
public override int GetHashCode()
45+
{
46+
return base.GetHashCode();
47+
}
4548
private static object GetValueToCompare(object obj)
4649
{
4750
var tc = Type.GetTypeCode(obj.GetType());

src/EPPlus/WorksheetZipStream.cs

+1
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ private int FindElementPos(string xml, string element, bool returnStartPos = tru
402402
/// </summary>
403403
/// <param name="xml">The xml to search</param>
404404
/// <param name="element">The element</param>
405+
/// <param name="prefix">The namespace prefix, if any</param>
405406
/// <param name="returnStartPos">If the position before the start element is returned. If false the end of the end element is returned.</param>
406407
/// <param name="ix">The index</param>
407408
/// <returns>The position of the element in the input xml</returns>

src/EPPlusTest/Drawing/CopyDrawingTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public void CopyDrawingsRange()
283283

284284
private class Item
285285
{
286-
public string? Name { get; set; }
286+
public string Name { get; set; }
287287

288288
public int Value { get; set; }
289289
}

src/EPPlusTest/FormulaParsing/Excel/Functions/RefAndLookup/GetPivotData/GetPivotDataTests_CalculatedFields.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace EPPlusTest.FormulaParsing.Excel.Functions.RefAndLookup
1515
[TestClass]
1616
public class GetPivotDataTests_CalculatedFields : TestBase
1717
{
18-
private static ExcelWorksheet _dateWs1, _dateWs2, _dateWs3;
18+
private static ExcelWorksheet _dateWs1;
1919
private static ExcelPackage _package;
2020
[ClassInitialize]
2121
public static void TestInitialize(TestContext context)

src/EPPlusTest/FormulaParsing/Excel/Functions/Statistical/LogestTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33
using OfficeOpenXml;
4-
using System;
54
using System.Collections.Generic;
65
using System.IO;
76
using System.Linq;

src/EPPlusTest/Issues/WorksheetIssues.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public void s668()
334334
excelCalculationOption.AllowCircularReferences = true;
335335
worksheet.Calculate(excelCalculationOption);
336336
}
337-
catch (Exception ex)
337+
catch
338338
{
339339

340340

@@ -350,7 +350,7 @@ public void s668()
350350
excelCalculationOption.AllowCircularReferences = true;
351351
worksheet.Calculate(excelCalculationOption);
352352
}
353-
catch (Exception ex)
353+
catch
354354
{
355355

356356

@@ -396,7 +396,7 @@ public void s720()
396396
}
397397
catch (Exception ex)
398398
{
399-
Console.WriteLine("error");
399+
Console.WriteLine($"error {ex}");
400400
}
401401

402402
SaveAndCleanup(p);

src/EPPlusTest/Table/PivotTable/Calculation/VerifyPivotCalculationWorkbookTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class VerifyPivotCalculationWorkbookTests : TestBase
1313
{
1414
static ExcelPackage _package;
1515
static ExcelWorksheet _ptWs;
16-
static ExcelWorksheet _ptWs2;
1716
[ClassInitialize]
1817
public static void Init(TestContext context)
1918

src/EPPlusTest/Table/PivotTable/Calculation/VerifyPivotCalculationWorkbookWithRefreshedCacheTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class VerifyPivotCalculationWorkbookWithRefreshedCacheTests : TestBase
1313
{
1414
static ExcelPackage _package;
1515
static ExcelWorksheet _ptWs;
16-
static ExcelWorksheet _ptWs2;
1716
[ClassInitialize]
1817
public static void Init(TestContext context)
1918

src/EPPlusTest/Table/PivotTable/PivotTableConditionalFormattingReadTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ namespace EPPlusTest.Table.PivotTable
1515
public class PivotTableConditionalFormattingReadTests : TestBase
1616
{
1717
static ExcelPackage _pck;
18-
static ExcelWorksheet _ws;
1918
[ClassInitialize]
2019
public static void Init(TestContext context)
2120
{

0 commit comments

Comments
 (0)