-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reuse code between async/sync methods (#602)
* Reuse code between async/sync methods * Update checkout action * Change access modifiers --------- Co-authored-by: Lukasz Arciszewski <[email protected]>
- Loading branch information
1 parent
fdfe883
commit c79c64d
Showing
24 changed files
with
1,016 additions
and
887 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,12 @@ | ||
namespace MiniExcelLibs.OpenXml.Constants | ||
{ | ||
internal static class ExcelContentTypes | ||
{ | ||
internal const string Relationships = "application/vnd.openxmlformats-package.relationships+xml"; | ||
internal const string SharedStrings = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"; | ||
internal const string Worksheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"; | ||
internal const string Styles = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"; | ||
internal const string Drawing = "application/vnd.openxmlformats-officedocument.drawing+xml"; | ||
internal const string Workbook = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"; | ||
} | ||
} |
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,19 @@ | ||
namespace MiniExcelLibs.OpenXml.Constants | ||
{ | ||
internal static class ExcelFileNames | ||
{ | ||
internal const string Rels = "_rels/.rels"; | ||
internal const string SharedStrings = "xl/sharedStrings.xml"; | ||
|
||
internal const string ContentTypes = "[Content_Types].xml"; | ||
internal const string Styles = "xl/styles.xml"; | ||
internal const string Workbook = "xl/workbook.xml"; | ||
internal const string WorkbookRels = "xl/_rels/workbook.xml.rels"; | ||
internal static string SheetRels(int sheetId) | ||
=> $"xl/worksheets/_rels/sheet{sheetId}.xml.rels"; | ||
internal static string Drawing(int sheetIndex) | ||
=> $"xl/drawings/drawing{sheetIndex + 1}.xml"; | ||
internal static string DrawingRels(int sheetIndex) | ||
=> $"xl/drawings/_rels/drawing{sheetIndex + 1}.xml.rels"; | ||
} | ||
} |
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,41 @@ | ||
using System.Globalization; | ||
|
||
namespace MiniExcelLibs.OpenXml.Constants | ||
{ | ||
internal class WorksheetXml | ||
{ | ||
internal const string StartWorksheet = @"<?xml version=""1.0"" encoding=""utf-8""?><x:worksheet xmlns:x=""http://schemas.openxmlformats.org/spreadsheetml/2006/main"">"; | ||
internal const string StartWorksheetWithRelationship = @"<?xml version=""1.0"" encoding=""utf-8""?><x:worksheet xmlns:r=""http://schemas.openxmlformats.org/officeDocument/2006/relationships"" xmlns:x=""http://schemas.openxmlformats.org/spreadsheetml/2006/main"" >"; | ||
internal const string EndWorksheet = "</x:worksheet>"; | ||
|
||
internal const string StartDimension = @"<x:dimension ref="""; | ||
internal const string DimensionPlaceholder = " />"; | ||
internal static string Dimension(string dimensionRef) | ||
=> $"{StartDimension}{dimensionRef}\"/>"; | ||
|
||
internal const string StartSheetData = "<x:sheetData>"; | ||
internal const string EndSheetData = "</x:sheetData>"; | ||
|
||
internal static string StartRow(int rowIndex) | ||
=> $"<x:row r=\"{rowIndex}\">"; | ||
internal const string EndRow = "</x:row>"; | ||
|
||
internal const string StartCols = "<x:cols>"; | ||
internal static string Column(int? colIndex, double? columnWidth) | ||
=> $@"<x:col min=""{colIndex.GetValueOrDefault() + 1}"" max=""{colIndex.GetValueOrDefault() + 1}"" width=""{columnWidth?.ToString(CultureInfo.InvariantCulture)}"" customWidth=""1"" />"; | ||
internal const string EndCols = "</x:cols>"; | ||
|
||
internal static string EmptyCell(string cellReference, string styleIndex) | ||
=> $"<x:c r=\"{cellReference}\" s=\"{styleIndex}\"></x:c>"; | ||
//t check avoid format error ![image](https://user-images.githubusercontent.com/12729184/118770190-9eee3480-b8b3-11eb-9f5a-87a439f5e320.png) | ||
internal static string Cell(string cellReference, string cellType, string styleIndex, string cellValue, bool preserveSpace = false) | ||
=> $"<x:c r=\"{cellReference}\"{(cellType == null ? string.Empty : $" t=\"{cellType}\"")} s=\"{styleIndex}\"{(preserveSpace ? " xml:space=\"preserve\"" : string.Empty)}><x:v>{cellValue}</x:v></x:c>"; | ||
|
||
internal static string Autofilter(string dimensionRef) | ||
=> $"<x:autoFilter ref=\"{dimensionRef}\" />"; | ||
|
||
internal static string Drawing(int sheetIndex) | ||
=> $"<x:drawing r:id=\"drawing{sheetIndex}\" />"; | ||
|
||
} | ||
} |
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.