Skip to content

Commit 72b471a

Browse files
committed
Support Assembly Strong Name Signature mini-software#450
1 parent 91b854f commit 72b471a

17 files changed

Lines changed: 148 additions & 156 deletions

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424

2525

2626

27+
### 1.28.2
28+
29+
- [New] Support Assembly Strong Name Signature #450
30+
- [New] Support QueryRange (via @1ras1)
31+
2732
### 1.28.1
2833

2934
- [Optimization] Reduce string memory allocation when template save #439 (via @cupsos)

docs/README.zh-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727

2828

2929

30+
### 1.28.2
31+
32+
- [New] 支持 Assembly Strong Name Signature #450
33+
- [New] 支持 QueryRange (via @1ras1)
34+
3035
### 1.28.1
3136

3237
- [Optimization] 减少 template save string memory allocation #439 (via @cupsos)

docs/README.zh-Hant.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626

2727

2828

29+
30+
31+
### 1.28.2
32+
33+
- [New] 支持 Assembly Strong Name Signature #450
34+
- [New] 支持 QueryRange (via @1ras1)
35+
2936
### 1.28.1
3037

3138
- [Optimization] 減少 template save string memory allocation #439 (via @cupsos)

src/MiniExcel/Csv/CsvReader.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public void Dispose()
9292
{
9393
}
9494

95-
//2022-09-24 excelReaderRange
9695
#region Range
9796
public IEnumerable<IDictionary<string, object>> QueryRange(bool useHeaderRow, string sheetName, string startCell, string endCell)
9897
{

src/MiniExcel/Csv/CsvWriter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ internal class CsvWriter : IExcelWriter, IDisposable
2121
private object _value;
2222
private readonly StreamWriter _writer;
2323
private bool disposedValue;
24-
private object _insertValue;
2524

2625
public CsvWriter(Stream stream, object value, IConfiguration configuration, bool printHeader)
2726
{

src/MiniExcel/IExcelReader.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,9 @@ internal interface IExcelReader: IDisposable
1515
IEnumerable<T> Query<T>(string sheetName, string startCell) where T : class, new();
1616
Task<IEnumerable<IDictionary<string, object>>> QueryAsync(bool UseHeaderRow, string sheetName, string startCell,CancellationToken cancellationToken = default(CancellationToken));
1717
Task<IEnumerable<T>> QueryAsync<T>(string sheetName, string startCell,CancellationToken cancellationToken = default(CancellationToken)) where T : class, new();
18-
19-
//
2018
IEnumerable<IDictionary<string, object>> QueryRange(bool UseHeaderRow, string sheetName, string startCell, string endCell);
2119
IEnumerable<T> QueryRange<T>(string sheetName, string startCell, string endCell) where T : class, new();
2220
Task<IEnumerable<IDictionary<string, object>>> QueryAsyncRange(bool UseHeaderRow, string sheetName, string startCell, string endCell, CancellationToken cancellationToken = default(CancellationToken));
2321
Task<IEnumerable<T>> QueryAsyncRange<T>(string sheetName, string startCell, string endCell, CancellationToken cancellationToken = default(CancellationToken)) where T : class, new();
24-
//
25-
26-
27-
2822
}
2923
}

src/MiniExcel/MiniExcel.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ public static void SaveAs(this Stream stream, object value, bool printHeader = t
7676
yield return item;
7777
}
7878
}
79-
80-
//1
8179
public static IEnumerable<dynamic> Query(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)
8280
{
8381
using (var stream = FileHelper.OpenSharedRead(path))
8482
foreach (var item in Query(stream, useHeaderRow, sheetName, ExcelTypeHelper.GetExcelType(path, excelType), startCell, configuration))
8583
yield return item;
8684
}
87-
88-
//2
8985
public static IEnumerable<dynamic> Query(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "A1", IConfiguration configuration = null)
9086
{
9187
using (var excelReader = ExcelReaderFactory.GetProvider(stream, ExcelTypeHelper.GetExcelType(stream, excelType), configuration))
@@ -96,26 +92,13 @@ public static IEnumerable<dynamic> Query(this Stream stream, bool useHeaderRow =
9692

9793
#region range
9894

99-
//3
100-
/// <summary>
101-
///
102-
/// </summary>
103-
/// <param name="path">路径</param>
104-
/// <param name="useHeaderRow">表头</param>
105-
/// <param name="sheetName">表名称</param>
106-
/// <param name="excelType">excel类型</param>
107-
/// <param name="startCell">开始单元格,支持为空读所有,默认A1,或者B列,或者B2单元格</param>
108-
/// <param name="endCell">结束单元格,支持为空读所有,或者为D别,或者D2单元格</param>
109-
/// <param name="configuration">配置</param>
110-
/// <returns></returns>
11195
public static IEnumerable<dynamic> QueryRange(string path, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "a1", string endCell = "", IConfiguration configuration = null)
11296
{
11397
using (var stream = FileHelper.OpenSharedRead(path))
11498
foreach (var item in QueryRange(stream, useHeaderRow, sheetName, ExcelTypeHelper.GetExcelType(path, excelType), startCell == "" ? "a1" : startCell, endCell, configuration))
11599
yield return item;
116100
}
117101

118-
//4
119102
public static IEnumerable<dynamic> QueryRange(this Stream stream, bool useHeaderRow = false, string sheetName = null, ExcelType excelType = ExcelType.UNKNOWN, string startCell = "a1", string endCell = "", IConfiguration configuration = null)
120103
{
121104
using (var excelReader = ExcelReaderFactory.GetProvider(stream, ExcelTypeHelper.GetExcelType(stream, excelType), configuration))

src/MiniExcel/MiniExcelLibs.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
<Title>MiniExcel</Title>
99
<Product>MiniExcel</Product>
1010
<PackageTags>excel;xlsx;csv;micro-helper;mini;openxml;helper;</PackageTags>
11-
<Description>
12-
Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet
13-
14-
Github : https://github.com/mini-software/MiniExcel
15-
Gitee : https://gitee.com/dotnetchina/MiniExcel
16-
Issues : https://github.com/mini-software/MiniExcel/issues
17-
Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true
18-
</Description>
11+
<Description>Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet
12+
Github : https://github.com/mini-software/MiniExcel
13+
Gitee : https://gitee.com/dotnetchina/MiniExcel
14+
Issues : https://github.com/mini-software/MiniExcel/issues
15+
Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true</Description>
1916
<Authors>LIN,WEI-HAN</Authors>
2017
<PackageId>MiniExcel</PackageId>
2118
<Copyright>LIN,WEI-HAN, 2021 onwards</Copyright>
@@ -28,6 +25,7 @@
2825
<PackageIcon>icon.png</PackageIcon>
2926
<PackageReleaseNotes>Please Check [Release Notes](https://github.com/mini-software/MiniExcel/tree/master/docs)</PackageReleaseNotes>
3027
<RepositoryType>Github</RepositoryType>
28+
<AssemblyOriginatorKeyFile>miniexcel.snk</AssemblyOriginatorKeyFile>
3129
</PropertyGroup>
3230
<ItemGroup Condition=" '$(TargetFramework)' == 'net461'">
3331
<Reference Include="System.IO.Compression" />

src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ namespace MiniExcelLibs.OpenXml
1616
{
1717
internal class ExcelOpenXmlSheetReader : IExcelReader
1818
{
19-
#region MyRegion
20-
2119
private bool _disposed = false;
2220
private static readonly string[] _ns = { Config.SpreadsheetmlXmlns, Config.SpreadsheetmlXmlStrictns };
2321
private static readonly string[] _relationshiopNs = { Config.SpreadsheetmlXmlRelationshipns, Config.SpreadsheetmlXmlStrictRelationshipns };
@@ -757,13 +755,10 @@ protected virtual void Dispose(bool disposing)
757755
}
758756
}
759757

760-
#endregion MyRegion
761-
762758
#region ReaderRange
763759

764760
public IEnumerable<IDictionary<string, object>> QueryRange(bool useHeaderRow, string sheetName, string startCell, string endCell)
765761
{
766-
//2022-09-27
767762
if (!ReferenceHelper.ParseReference(startCell, out var startColumnIndex, out var startRowIndex) == false ? true : true)
768763
{
769764
//throw new InvalidDataException($"startCell {startCell} is Invalid");

src/MiniExcel/OpenXml/ExcelOpenXmlUtils.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
{
33
using MiniExcelLibs.Utils;
44
using System;
5-
internal static class ExcelOpenXmlUtils
5+
#if DEBUG
6+
public
7+
#else
8+
internal
9+
#endif
10+
static class ExcelOpenXmlUtils
611
{
712
/// <summary>
813
/// Encode to XML (special characteres: &apos; &quot; &gt; &lt; &amp;)
914
/// </summary>
10-
internal static string EncodeXML(string value) => value == null
15+
public static string EncodeXML(string value) => value == null
1116
? string.Empty
1217
: XmlEncoder.EncodeString(value)
1318
.Replace("&", "&amp;")
@@ -18,13 +23,13 @@ internal static string EncodeXML(string value) => value == null
1823
.ToString();
1924

2025
/// <summary>X=CellLetter,Y=CellNumber,ex:A1=(1,1),B2=(2,2)</summary>
21-
internal static string ConvertXyToCell(Tuple<int, int> xy)
26+
public static string ConvertXyToCell(Tuple<int, int> xy)
2227
{
2328
return ConvertXyToCell(xy.Item1, xy.Item2);
2429
}
2530

2631
/// <summary>X=CellLetter,Y=CellNumber,ex:A1=(1,1),B2=(2,2)</summary>
27-
internal static string ConvertXyToCell(int x, int y)
32+
public static string ConvertXyToCell(int x, int y)
2833
{
2934
int dividend = x;
3035
string columnName = String.Empty;
@@ -40,12 +45,12 @@ internal static string ConvertXyToCell(int x, int y)
4045
}
4146

4247
/// <summary>X=CellLetter,Y=CellNumber,ex:A1=(1,1),B2=(2,2)</summary>
43-
internal static Tuple<int, int> ConvertCellToXY(string cell)
48+
public static Tuple<int, int> ConvertCellToXY(string cell)
4449
{
4550
return Tuple.Create(GetCellColumnIndex(cell), GetCellRowNumber(cell));
4651
}
4752

48-
internal static int GetColumnNumber(string name)
53+
public static int GetColumnNumber(string name)
4954
{
5055
int number = -1;
5156
int pow = 1;
@@ -58,7 +63,7 @@ internal static int GetColumnNumber(string name)
5863
return number;
5964
}
6065

61-
internal static int GetCellColumnIndex(string cell)
66+
public static int GetCellColumnIndex(string cell)
6267
{
6368
const string keys = " ABCDEFGHIJKLMNOPQRSTUVWXYZ";
6469
const int mode = 26;
@@ -72,7 +77,7 @@ internal static int GetCellColumnIndex(string cell)
7277
return x;
7378
}
7479

75-
internal static int GetCellRowNumber(string cell)
80+
public static int GetCellRowNumber(string cell)
7681
{
7782
if (string.IsNullOrEmpty(cell))
7883
throw new Exception("cell is null or empty");
@@ -85,7 +90,7 @@ internal static int GetCellRowNumber(string cell)
8590
return int.Parse(cellNumber);
8691
}
8792

88-
internal static string GetCellColumnLetter(string cell)
93+
public static string GetCellColumnLetter(string cell)
8994
{
9095
string GetCellLetter = string.Empty;
9196
for (int i = 0; i < cell.Length; i++)
@@ -96,7 +101,7 @@ internal static string GetCellColumnLetter(string cell)
96101
return GetCellLetter;
97102
}
98103

99-
internal static string ConvertColumnName(int x)
104+
public static string ConvertColumnName(int x)
100105
{
101106
int dividend = x;
102107
string columnName = String.Empty;

0 commit comments

Comments
 (0)