Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
{
//Validate input
if (string.IsNullOrWhiteSpace(exportConfiguration.WorksheetName))
throw new ArgumentException("Worksheet name must be supplied", nameof(exportConfiguration.WorksheetName));

Check warning on line 35 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

The parameter name 'WorksheetName' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)

if (exportConfiguration.ExportData == null)
throw new ArgumentException("Export data must be specified", nameof(exportConfiguration.ExportData));

Check warning on line 38 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

The parameter name 'ExportData' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)

if (exportConfiguration.RenderTitle && string.IsNullOrEmpty(exportConfiguration.DocumentTitle))
throw new ArgumentException("Document Title is required when 'Render Title' is true",

Check warning on line 41 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

The parameter name 'DocumentTitle' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)
nameof(exportConfiguration.DocumentTitle));

if (exportConfiguration.RenderSubTitle && string.IsNullOrEmpty(exportConfiguration.DocumentSubTitle))
throw new ArgumentException("Document Sub Title is required when 'Render Sub Title' is true",

Check warning on line 45 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

The parameter name 'DocumentSubTitle' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)
nameof(exportConfiguration.DocumentSubTitle));

//Create the document & overall workbook
Expand All @@ -66,10 +66,10 @@

//If we are freezing panes add the sheet views, this is done BEFORE the data is loaded
if (exportConfiguration.FreezeHeaders)
worksheetPart.Worksheet.Append(CreateFreezePane(exportConfiguration));

Check warning on line 69 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

Review this call, which partially matches an overload without 'params'. The partial match is 'void OpenXmlElement.Append(IEnumerable<OpenXmlElement> newChildren)'. (https://rules.sonarsource.com/csharp/RSPEC-3220)

//Load the actual data
worksheetPart.Worksheet.Append(columns);

Check warning on line 72 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

Review this call, which partially matches an overload without 'params'. The partial match is 'void OpenXmlElement.Append(IEnumerable<OpenXmlElement> newChildren)'. (https://rules.sonarsource.com/csharp/RSPEC-3220)
worksheetPart.Worksheet.Append(data);

//If Filtering, add it after we have added the data
Expand Down Expand Up @@ -124,8 +124,8 @@
Pane = PaneValues.BottomLeft,
ActiveCell = topLeft
};
defaultView.Append(pane);

Check warning on line 127 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

Review this call, which partially matches an overload without 'params'. The partial match is 'void OpenXmlElement.Append(IEnumerable<OpenXmlElement> newChildren)'. (https://rules.sonarsource.com/csharp/RSPEC-3220)
defaultView.Append(selection1);

Check warning on line 128 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

Review this call, which partially matches an overload without 'params'. The partial match is 'void OpenXmlElement.Append(IEnumerable<OpenXmlElement> newChildren)'. (https://rules.sonarsource.com/csharp/RSPEC-3220)
sheetViews.Append(defaultView);
return sheetViews;
}
Expand Down Expand Up @@ -534,7 +534,7 @@
NumberFormatId = 22,
ApplyNumberFormat = true
},
new CellFormat
new CellFormat // F0
{
FormatId = 0,
FontId = 0,
Expand All @@ -543,30 +543,50 @@
NumberFormatId = 301,
ApplyNumberFormat = true
},
new CellFormat
new CellFormat // F1
{
FormatId = 0,
FontId = 0,
BorderId = 0,
FillId = 0,
NumberFormatId = 302,
ApplyNumberFormat = true
}, new CellFormat
},
new CellFormat // F2
{
FormatId = 0,
FontId = 0,
BorderId = 0,
FillId = 0,
NumberFormatId = 303,
ApplyNumberFormat = true
}, new CellFormat
},
new CellFormat // F3
{
FormatId = 0,
FontId = 0,
BorderId = 0,
FillId = 0,
NumberFormatId = 304,
ApplyNumberFormat = true
},
new CellFormat // C3
{
FormatId = 0,
FontId = 0,
BorderId = 0,
FillId = 0,
NumberFormatId = 401,
ApplyNumberFormat = true
},
new CellFormat // C4
{
FormatId = 0,
FontId = 0,
BorderId = 0,
FillId = 0,
NumberFormatId = 402,
ApplyNumberFormat = true
}
);
return styles;
Expand All @@ -593,7 +613,7 @@
//iterate over all cells getting a max char value for each column
var maxWidth = 0;

//TODO: Adjust this to use Enum & Validate all style formats

Check warning on line 616 in src/NetCore.Utilities.Spreadsheet/OpenXmlSpreadsheetGenerator.cs

View workflow job for this annotation

GitHub Actions / Analyze Code Quality

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
var numberStyles = new UInt32[] { 7, 8 }; //styles that will add extra chars
var boldStyles = new UInt32[] { 1, 2, 3, 4, 6, 7, 8 }; //styles that will bold

Expand Down
Loading