ExcelMapper icon indicating copy to clipboard operation
ExcelMapper copied to clipboard

Adds Table formatting to Save methods

Open SheepRock opened this issue 4 years ago • 4 comments

Adds an option to specify an Excel table style to apply to the data. Table styles are specified as the string name of the style ("TableStyleMedium3", "TableStyleLight7","TableStyleDark5").

Data must be save in xlsx and have HeaderRow enabled.

image

SheepRock avatar Aug 10 '21 14:08 SheepRock

Codecov Report

Merging #138 (e999382) into master (d86c8e6) will decrease coverage by 0.67%. The diff coverage is 83.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #138      +/-   ##
==========================================
- Coverage   93.80%   93.13%   -0.68%     
==========================================
  Files           9        9              
  Lines        1195     1252      +57     
  Branches      171      177       +6     
==========================================
+ Hits         1121     1166      +45     
- Misses         47       55       +8     
- Partials       27       31       +4     
Impacted Files Coverage Δ
ExcelMapper/ExcelMapper.cs 93.67% <83.56%> (-1.10%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d86c8e6...e999382. Read the comment docs.

codecov[bot] avatar Aug 10 '21 14:08 codecov[bot]

Sorry for the late response. I'm hesitant to add another parameter to the Save() methods. I'd rather add an event that gets invoked just before the workbook is written. The table styling method could then become an extension method of XSSFSheet.

mganss avatar Aug 31 '21 11:08 mganss

Will take a look. I was also thinking in using an enum instead of a string to the table style, what do you think? POI appears to have that enum, but it is absent in NPOI.

SheepRock avatar Aug 31 '21 12:08 SheepRock

You can have custom table styles can't you? If so, perhaps the builtin styles can become const strings.

mganss avatar Aug 31 '21 12:08 mganss