diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 088e5b8a..ac2cfdd9 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -4,8 +4,8 @@ - - + + diff --git a/src/MiniExcel.Core/Attributes/MiniExcelColumnNameAttribute.cs b/src/MiniExcel.Core/Attributes/MiniExcelColumnNameAttribute.cs index cf2c74ba..6ea6d69a 100644 --- a/src/MiniExcel.Core/Attributes/MiniExcelColumnNameAttribute.cs +++ b/src/MiniExcel.Core/Attributes/MiniExcelColumnNameAttribute.cs @@ -6,8 +6,6 @@ public class MiniExcelColumnNameAttribute(string columnName, string[]? aliases = { private ResourceManager? _resourceManager; - [Obsolete("Please use the \"Name\" property instead")] - public string ExcelColumnName { get; set; } = columnName; public string Name { get; set; } = columnName; public string[] Aliases { get; set; } = aliases ?? []; diff --git a/src/MiniExcel.Core/MiniExcelV2.cs b/src/MiniExcel.Core/MiniExcelV2.cs index 7fe2073c..e8a50229 100644 --- a/src/MiniExcel.Core/MiniExcelV2.cs +++ b/src/MiniExcel.Core/MiniExcelV2.cs @@ -10,12 +10,3 @@ public static class MiniExcelV2 public static readonly MiniExcelTemplaterProvider Templaters = new(); public static readonly MiniExcelEditorProvider Editors = new(); } - -[Obsolete("This class will be removed in the full release, use MiniExcelV2 instead.", true)] -public static class MiniExcel -{ - public static readonly MiniExcelExporterProvider Exporters = new(); - public static readonly MiniExcelImporterProvider Importers = new(); - public static readonly MiniExcelTemplaterProvider Templaters = new(); - public static readonly MiniExcelEditorProvider Editors = new(); -} diff --git a/src/MiniExcel.Csv/CsvConfiguration.cs b/src/MiniExcel.Csv/CsvConfiguration.cs index 8f614bf8..3a4d8bfd 100644 --- a/src/MiniExcel.Csv/CsvConfiguration.cs +++ b/src/MiniExcel.Csv/CsvConfiguration.cs @@ -16,13 +16,6 @@ public class CsvConfiguration : MiniExcelBaseConfiguration /// Empty fields will be converted to null when queried as strings, or to the default value of the corresponding mapped type. /// public bool ReadEmptyFieldsAsDefault { get; set; } = false; - - [Obsolete("Please use the ReadEmptyFieldsAsDefault property instead")] - public bool ReadEmptyStringAsNull - { - get => ReadEmptyFieldsAsDefault; - set => ReadEmptyFieldsAsDefault = value; - } /// /// When set to true, rows with fewer columns than the header are padded with default values diff --git a/src/MiniExcel.OpenXml.FluentMapping/Api/MappingTemplater.cs b/src/MiniExcel.OpenXml.FluentMapping/Api/MappingTemplater.cs index 417e78bf..b1cf6518 100644 --- a/src/MiniExcel.OpenXml.FluentMapping/Api/MappingTemplater.cs +++ b/src/MiniExcel.OpenXml.FluentMapping/Api/MappingTemplater.cs @@ -75,38 +75,4 @@ public async Task FillTemplateAsync( await FillTemplateAsync(outputStream, templateStream, values, cancellationToken).ConfigureAwait(false); } - -#region Obsolete -[CreateSyncVersion, Obsolete("Please use FillTemplate or FillTemplateAsync instead.")] -public Task ApplyTemplateAsync( - string? outputPath, - string? templatePath, - IEnumerable? values, - CancellationToken cancellationToken = default) where T : class -{ - return FillTemplateAsync(outputPath, templatePath, values, cancellationToken); -} - -[CreateSyncVersion, Obsolete("Please use FillTemplate or FillTemplateAsync instead.")] -public Task ApplyTemplateAsync( - Stream? outputStream, - Stream? templateStream, - IEnumerable? values, - CancellationToken cancellationToken = default) where T : class -{ - return FillTemplateAsync(outputStream, templateStream, values, cancellationToken); } - - -[CreateSyncVersion, Obsolete("Please use FillTemplate or FillTemplateAsync instead.")] -public Task ApplyTemplateAsync( - Stream? outputStream, - byte[]? templateBytes, - IEnumerable? values, - CancellationToken cancellationToken = default) where T : class -{ - return FillTemplateAsync(outputStream, templateBytes, values, cancellationToken); -} -#endregion -} - diff --git a/src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs b/src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs index 80dca3d8..51d07e79 100644 --- a/src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs +++ b/src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs @@ -189,36 +189,4 @@ public async Task ExportAsync(Stream stream, object value, bool printHead return await writer.SaveAsAsync(progress, cancellationToken).ConfigureAwait(false); } - - /// - /// Modify the properties of a worksheet in the specified document. - /// - /// The path to the OpenXml document. - /// The name of the worksheet to modify. - /// The new name to assign to the worksheet, or null to leave as is. - /// The position in the workbook to assign to the worksheet, or null to leave as is. - /// The visibility state to assign to the worksheet, or null to leave as is. - /// The token to monitor for cancellation requests - [CreateSyncVersion] - [Obsolete("This method will be removed in the full release, please use MiniExcelV2.Editors.GetOpenXmlEditor().AlterSheetInfo instead.")] - public async Task AlterSheetAsync(string path, string sheetName, string? newSheetName = null, int? newSheetIndex = null, SheetState? newSheetState = null, CancellationToken cancellationToken = default) - { - await new OpenXmlEditor().AlterSheetInfoAsync(path, sheetName, newSheetName, newSheetIndex, newSheetState, cancellationToken).ConfigureAwait(false); - } - - /// - /// Modify the properties of a worksheet in the specified document. - /// - /// The stream to the OpenXml document. - /// The name of the worksheet to modify. - /// The new name to assign to the worksheet, or null to leave as is. - /// The position in the workbook to assign to the worksheet, or null to leave as is. - /// The visibility state to assign to the worksheet, or null to leave as is. - /// The token to monitor for cancellation requests - [CreateSyncVersion] - [Obsolete("This method will be removed in the full release, please use MiniExcelV2.Editors.GetOpenXmlEditor().AlterSheetInfo instead.")] - public async Task AlterSheetAsync(Stream stream, string sheetName, string? newSheetName = null, int? newSheetIndex = null, SheetState? newSheetState = null, CancellationToken cancellationToken = default) - { - await new OpenXmlEditor().AlterSheetInfoAsync(stream, sheetName, newSheetName, newSheetIndex, newSheetState, cancellationToken).ConfigureAwait(false); - } } diff --git a/src/MiniExcel/Attributes.cs b/src/MiniExcel/Attributes.cs index 6dc24a20..d9918476 100644 --- a/src/MiniExcel/Attributes.cs +++ b/src/MiniExcel/Attributes.cs @@ -13,7 +13,15 @@ public ExcelColumnIndexAttribute(int excelColumnIndex) : base(excelColumnIndex) public ExcelColumnIndexAttribute(string excelColumnName) : base(excelColumnName) { } } -public sealed class ExcelColumnNameAttribute(string excelColumnName) : MiniExcelColumnNameAttribute(columnName: excelColumnName); +public sealed class ExcelColumnNameAttribute(string excelColumnName) + : MiniExcelColumnNameAttribute(columnName: excelColumnName) +{ + public string ExcelColumnName + { + get => Name; + set => Name = value; + } +} public sealed class ExcelColumnWidthAttribute(double width) : MiniExcelColumnWidthAttribute(width); diff --git a/src/MiniExcel/Configuration.cs b/src/MiniExcel/Configuration.cs index 88028e39..e525b36f 100644 --- a/src/MiniExcel/Configuration.cs +++ b/src/MiniExcel/Configuration.cs @@ -12,5 +12,12 @@ public sealed class OpenXmlConfiguration : MiniExcelLib.OpenXml.OpenXmlConfigura namespace MiniExcelLibs.Csv { - public sealed class CsvConfiguration : MiniExcelLib.Csv.CsvConfiguration, IConfiguration; + public sealed class CsvConfiguration : MiniExcelLib.Csv.CsvConfiguration, IConfiguration + { + public bool ReadEmptyStringAsNull + { + get => ReadEmptyFieldsAsDefault; + set => ReadEmptyFieldsAsDefault = value; + } + } } diff --git a/tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj b/tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj index fba820ec..083fc5ec 100644 --- a/tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj +++ b/tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj @@ -15,9 +15,9 @@ - + - + all diff --git a/tests/MiniExcel.OpenXml.Tests/MiniExcel.OpenXml.Tests.csproj b/tests/MiniExcel.OpenXml.Tests/MiniExcel.OpenXml.Tests.csproj index a056037d..1ef38181 100644 --- a/tests/MiniExcel.OpenXml.Tests/MiniExcel.OpenXml.Tests.csproj +++ b/tests/MiniExcel.OpenXml.Tests/MiniExcel.OpenXml.Tests.csproj @@ -14,12 +14,13 @@ - - - - + - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive