Skip to content

Commit dd00a40

Browse files
Removed ObsoleteAttribute from the old methods' signatures and moved the AddPicture methods from the OpenXmlExporter to the OpenXmlTemplater
1 parent 6eefe8c commit dd00a40

File tree

6 files changed

+31
-85
lines changed

6 files changed

+31
-85
lines changed

src/MiniExcel.Core/Api/OpenXmlExporter.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using MiniExcelLib.Core.OpenXml.Picture;
2-
31
// ReSharper disable once CheckNamespace
42
namespace MiniExcelLib.Core;
53

@@ -8,19 +6,6 @@ public sealed partial class OpenXmlExporter
86
internal OpenXmlExporter() { }
97

108

11-
[CreateSyncVersion]
12-
public async Task AddPictureAsync(string path, CancellationToken cancellationToken = default, params MiniExcelPicture[] images)
13-
{
14-
using var stream = File.Open(path, FileMode.OpenOrCreate);
15-
await MiniExcelPictureImplement.AddPictureAsync(stream, cancellationToken, images).ConfigureAwait(false);
16-
}
17-
18-
[CreateSyncVersion]
19-
public async Task AddPictureAsync(Stream excelStream, CancellationToken cancellationToken = default, params MiniExcelPicture[] images)
20-
{
21-
await MiniExcelPictureImplement.AddPictureAsync(excelStream, cancellationToken, images).ConfigureAwait(false);
22-
}
23-
249
[CreateSyncVersion]
2510
public async Task<int> InsertSheetAsync(string path, object value, string? sheetName = "Sheet1", bool printHeader = true, bool overwriteSheet = false, OpenXmlConfiguration? configuration = null, CancellationToken cancellationToken = default)
2611
{

src/MiniExcel.Core/Api/OpenXmlTemplater.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using MiniExcelLib.Core.OpenXml.Picture;
12
using MiniExcelLib.Core.OpenXml.Templates;
23

34
// ReSharper disable once CheckNamespace
@@ -7,7 +8,19 @@ public sealed partial class OpenXmlTemplater
78
{
89
internal OpenXmlTemplater() { }
910

10-
11+
[CreateSyncVersion]
12+
public async Task AddPictureAsync(string path, CancellationToken cancellationToken = default, params MiniExcelPicture[] images)
13+
{
14+
using var stream = File.Open(path, FileMode.OpenOrCreate);
15+
await MiniExcelPictureImplement.AddPictureAsync(stream, cancellationToken, images).ConfigureAwait(false);
16+
}
17+
18+
[CreateSyncVersion]
19+
public async Task AddPictureAsync(Stream excelStream, CancellationToken cancellationToken = default, params MiniExcelPicture[] images)
20+
{
21+
await MiniExcelPictureImplement.AddPictureAsync(excelStream, cancellationToken, images).ConfigureAwait(false);
22+
}
23+
1124
[CreateSyncVersion]
1225
public async Task ApplyTemplateAsync(string path, string templatePath, object value,
1326
OpenXmlConfiguration? configuration = null, CancellationToken cancellationToken = default)

src/MiniExcel/Legacy/Attributes.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,22 @@
44
namespace MiniExcelLibs.Attributes;
55

66

7-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
87
public sealed class ExcelColumnAttribute : MiniExcelColumnAttribute;
98

10-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
119
public sealed class ExcelColumnIndexAttribute : MiniExcelColumnIndexAttribute
1210
{
1311
public ExcelColumnIndexAttribute(int excelColumnIndex) : base(excelColumnIndex) { }
1412
public ExcelColumnIndexAttribute(string excelColumnName) : base(excelColumnName) { }
1513
}
1614

17-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
1815
public sealed class ExcelColumnNameAttribute(string excelColumnName) : MiniExcelColumnNameAttribute(columnName: excelColumnName);
1916

20-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
2117
public sealed class ExcelColumnWidthAttribute(double width) : MiniExcelColumnWidthAttribute(width);
2218

23-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
2419
public sealed class ExcelFormatAttribute(string format) : MiniExcelFormatAttribute(format);
2520

26-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
2721
public sealed class ExcelIgnoreAttribute(bool excelIgnore = true) : MiniExcelIgnoreAttribute(excelIgnore);
2822

29-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
3023
public sealed class ExcelSheetAttribute : MiniExcelSheetAttribute;
3124

32-
[Obsolete("This is a legacy attribute that will be removed in a future version. Please use the corresponding one from MiniExcelLib.Core.Attributes instead.")]
3325
public sealed class DynamicExcelSheetAttribute(string key) : MiniExcelLib.Core.Attributes.DynamicExcelSheetAttribute(key);

0 commit comments

Comments
 (0)