-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Servan42/develop
Version 1.2.0
- Loading branch information
Showing
12 changed files
with
390 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using OfficeOpenXml.Style; | ||
using OfficeOpenXml; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GherkinSimpleParser.Converter | ||
{ | ||
public static class ExcelExtensions | ||
{ | ||
public static void SetGridBorder(this ExcelWorksheet ws, ExcelBorderStyle borderStyle, int startRow, int endRow, int startCol, int endCol) | ||
{ | ||
for (int row = startRow; row <= endRow; row++) | ||
{ | ||
for (int col = startCol; col <= endCol; col++) | ||
{ | ||
GetCellAt(ws, row, col).Style.Border.BorderAround(borderStyle); | ||
} | ||
} | ||
} | ||
|
||
public static ExcelRange GetCellAt(this ExcelWorksheet ws, int row, int col) | ||
{ | ||
char colChar = (char)('A' - 1 + col); | ||
return ws.Cells[$"{colChar}{row}"]; | ||
} | ||
|
||
public static void SetColor(this ExcelWorksheet ws, string range, Color color) | ||
{ | ||
ws.Cells[range].Style.Fill.PatternType = ExcelFillStyle.Solid; | ||
ws.Cells[range].Style.Fill.BackgroundColor.SetColor(color); | ||
} | ||
|
||
public static void AlignCenter(this ExcelWorksheet ws, string range, bool vertical, bool horizontal) | ||
{ | ||
if (horizontal) | ||
ws.Cells[range].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; | ||
if (vertical) | ||
ws.Cells[range].Style.VerticalAlignment = ExcelVerticalAlignment.Center; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.