From 58446fd5de13efc27d63702d31d6c4221ddd7b4f Mon Sep 17 00:00:00 2001 From: Raphael Stoeckli Date: Sun, 12 Jan 2025 01:17:45 +0100 Subject: [PATCH] Update v2.6.0 --- Changelog.md | 10 + Demo/Demo.csproj | 8 +- Demo/Program.cs | 2 +- Documentation/CodeDocumentation.shfbproj | 2 +- NanoXLSX/Address.cs | 2 +- NanoXLSX/BasicFormulas.cs | 2 +- NanoXLSX/Cell.cs | 6 +- NanoXLSX/Column.cs | 2 +- NanoXLSX/Exceptions/FormatException.cs | 2 +- NanoXLSX/Exceptions/IOException.cs | 2 +- NanoXLSX/Exceptions/RangeException.cs | 2 +- NanoXLSX/Exceptions/StyleException.cs | 2 +- NanoXLSX/Exceptions/WorksheetException.cs | 2 +- NanoXLSX/ImportOptions.cs | 2 +- NanoXLSX/LowLevel/DocumentPath.cs | 2 +- NanoXLSX/LowLevel/MetadataReader.cs | 2 +- NanoXLSX/LowLevel/ReaderUtils.cs | 2 +- NanoXLSX/LowLevel/RelationshipReader.cs | 2 +- NanoXLSX/LowLevel/SharedStringsReader.cs | 2 +- NanoXLSX/LowLevel/SortedMap.cs | 2 +- NanoXLSX/LowLevel/StyleReader.cs | 2 +- NanoXLSX/LowLevel/StyleReaderContainer.cs | 2 +- NanoXLSX/LowLevel/WorkbookReader.cs | 2 +- NanoXLSX/LowLevel/WorksheetReader.cs | 2 +- NanoXLSX/LowLevel/XlsxReader.cs | 2 +- NanoXLSX/LowLevel/XlsxWriter.cs | 2 +- NanoXLSX/Metadata.cs | 2 +- NanoXLSX/NanoXLSX.csproj | 8 +- NanoXLSX/Range.cs | 2 +- NanoXLSX/Shortener.cs | 2 +- NanoXLSX/Styles/AbstractStyle.cs | 2 +- NanoXLSX/Styles/AppendAttribute.cs | 2 +- NanoXLSX/Styles/BasicStyles.cs | 2 +- NanoXLSX/Styles/Border.cs | 2 +- NanoXLSX/Styles/CellXf.cs | 2 +- NanoXLSX/Styles/Fill.cs | 2 +- NanoXLSX/Styles/Font.cs | 2 +- NanoXLSX/Styles/NumberFormat.cs | 2 +- NanoXLSX/Styles/Style.cs | 2 +- NanoXLSX/Styles/StyleManager.cs | 2 +- NanoXLSX/Styles/StyleRepository.cs | 2 +- NanoXLSX/Utils.cs | 2 +- NanoXLSX/Workbook.cs | 2 +- NanoXLSX/Worksheet.cs | 333 +++++++++++----------- NanoXlsx Test/NanoXLSX Test.csproj | 8 +- 45 files changed, 230 insertions(+), 221 deletions(-) diff --git a/Changelog.md b/Changelog.md index 276b5f3b7..63c68bfe0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,15 @@ # Change Log +## v2.6.0 + +--- +Release Date: **12.01.2025** + +- Added InsertRow and InsertColumn functions. Functionality provided by Alexander Schlecht +- Added FirstCewllByValue, FirstOrDefaultCell, CellsByValue functions. Functionality provided by Alexander Schlecht +- Added ReplaceCellValue function. Functionality provided by Alexander Schlecht +- Code maintenance + ## v2.5.2 --- diff --git a/Demo/Demo.csproj b/Demo/Demo.csproj index 66b17afc3..7003fc6a1 100644 --- a/Demo/Demo.csproj +++ b/Demo/Demo.csproj @@ -6,7 +6,7 @@ NanoXLSX Raphael Stoeckli Raphael Stoeckli - Copyright Raphael Stoeckli © 2024 + Copyright Raphael Stoeckli © 2025 Demo Library showing the use of NanoXLSX, a library to generate and read Microsoft Excel files (XLSX) in an easy and native way https://github.com/rabanti-github/NanoXLSX https://github.com/rabanti-github/NanoXLSX.git @@ -15,9 +15,9 @@ snupkg net45;net5.0 Demo.Program - 2.5.2 - 2.5.2.0 - 2.5.1.0 + 2.6.0 + 2.6.0.0 + 2.6.0.0 false MIT XLSX Excel ExcelWriter ExcelReader Office diff --git a/Demo/Program.cs b/Demo/Program.cs index ce456bb6c..33d7747c5 100644 --- a/Demo/Program.cs +++ b/Demo/Program.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/Documentation/CodeDocumentation.shfbproj b/Documentation/CodeDocumentation.shfbproj index b969d2c4a..7ea67057c 100644 --- a/Documentation/CodeDocumentation.shfbproj +++ b/Documentation/CodeDocumentation.shfbproj @@ -41,7 +41,7 @@ InheritedMembers, InheritedFrameworkMembers, Internals, Privates, Protected, SealedProtected, ProtectedInternalAsProtected, EditorBrowsableNever, NonBrowsable - Copyright Raphael Stoeckli &#169%3b 2024 + Copyright Raphael Stoeckli &#169%3b 2025 100 False &lt%3bp&gt%3bNanoXLSX is a small .NET / C# library to create and read XLSX files %28Microsoft Excel 2007 or newer%29 in an easy and native way&lt%3b/p&gt%3b diff --git a/NanoXLSX/Address.cs b/NanoXLSX/Address.cs index c8e38be2c..72698a5d9 100644 --- a/NanoXLSX/Address.cs +++ b/NanoXLSX/Address.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/BasicFormulas.cs b/NanoXLSX/BasicFormulas.cs index c2790455b..32aca7cb5 100644 --- a/NanoXLSX/BasicFormulas.cs +++ b/NanoXLSX/BasicFormulas.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Cell.cs b/NanoXLSX/Cell.cs index 2e00efc19..4f366f758 100644 --- a/NanoXLSX/Cell.cs +++ b/NanoXLSX/Cell.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ @@ -206,7 +206,7 @@ public Cell(object value, CellType type) /// Type of the cell /// Address of the cell /// If the is defined as any passed value will be set to null - public Cell(Object value, CellType type, string address) + public Cell(object value, CellType type, string address) { if (type == CellType.EMPTY) { @@ -231,7 +231,7 @@ public Cell(Object value, CellType type, string address) /// Type of the cell /// Address struct of the cell /// If the is defined as any passed value will be set to null - public Cell(Object value, CellType type, Address address) + public Cell(object value, CellType type, Address address) { if (type == CellType.EMPTY) { diff --git a/NanoXLSX/Column.cs b/NanoXLSX/Column.cs index a7d69dc96..7b859b656 100644 --- a/NanoXLSX/Column.cs +++ b/NanoXLSX/Column.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Exceptions/FormatException.cs b/NanoXLSX/Exceptions/FormatException.cs index 68968f742..6d1ef6755 100644 --- a/NanoXLSX/Exceptions/FormatException.cs +++ b/NanoXLSX/Exceptions/FormatException.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Exceptions/IOException.cs b/NanoXLSX/Exceptions/IOException.cs index 8a29f31c5..08c2a6bb9 100644 --- a/NanoXLSX/Exceptions/IOException.cs +++ b/NanoXLSX/Exceptions/IOException.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Exceptions/RangeException.cs b/NanoXLSX/Exceptions/RangeException.cs index 0ba3c1f83..fd214d685 100644 --- a/NanoXLSX/Exceptions/RangeException.cs +++ b/NanoXLSX/Exceptions/RangeException.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Exceptions/StyleException.cs b/NanoXLSX/Exceptions/StyleException.cs index b1576a412..9a9c496f0 100644 --- a/NanoXLSX/Exceptions/StyleException.cs +++ b/NanoXLSX/Exceptions/StyleException.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Exceptions/WorksheetException.cs b/NanoXLSX/Exceptions/WorksheetException.cs index 7f41486d0..fad514e1d 100644 --- a/NanoXLSX/Exceptions/WorksheetException.cs +++ b/NanoXLSX/Exceptions/WorksheetException.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/ImportOptions.cs b/NanoXLSX/ImportOptions.cs index 1431e54ed..6ca94348d 100644 --- a/NanoXLSX/ImportOptions.cs +++ b/NanoXLSX/ImportOptions.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/DocumentPath.cs b/NanoXLSX/LowLevel/DocumentPath.cs index 9da133c38..4e4ddedb0 100644 --- a/NanoXLSX/LowLevel/DocumentPath.cs +++ b/NanoXLSX/LowLevel/DocumentPath.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/MetadataReader.cs b/NanoXLSX/LowLevel/MetadataReader.cs index fcc0856c0..7c0340df7 100644 --- a/NanoXLSX/LowLevel/MetadataReader.cs +++ b/NanoXLSX/LowLevel/MetadataReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/ReaderUtils.cs b/NanoXLSX/LowLevel/ReaderUtils.cs index c18ed4b47..3550d2254 100644 --- a/NanoXLSX/LowLevel/ReaderUtils.cs +++ b/NanoXLSX/LowLevel/ReaderUtils.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way -* Copyright Raphael Stoeckli © 2024 +* Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/RelationshipReader.cs b/NanoXLSX/LowLevel/RelationshipReader.cs index aa89aea83..974443e6b 100644 --- a/NanoXLSX/LowLevel/RelationshipReader.cs +++ b/NanoXLSX/LowLevel/RelationshipReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/SharedStringsReader.cs b/NanoXLSX/LowLevel/SharedStringsReader.cs index 1882d09e4..9f1df55f9 100644 --- a/NanoXLSX/LowLevel/SharedStringsReader.cs +++ b/NanoXLSX/LowLevel/SharedStringsReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/SortedMap.cs b/NanoXLSX/LowLevel/SortedMap.cs index 401a941e5..609f90f38 100644 --- a/NanoXLSX/LowLevel/SortedMap.cs +++ b/NanoXLSX/LowLevel/SortedMap.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/StyleReader.cs b/NanoXLSX/LowLevel/StyleReader.cs index fcba3af46..395824f48 100644 --- a/NanoXLSX/LowLevel/StyleReader.cs +++ b/NanoXLSX/LowLevel/StyleReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/StyleReaderContainer.cs b/NanoXLSX/LowLevel/StyleReaderContainer.cs index fa682c930..9b8352d9b 100644 --- a/NanoXLSX/LowLevel/StyleReaderContainer.cs +++ b/NanoXLSX/LowLevel/StyleReaderContainer.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/WorkbookReader.cs b/NanoXLSX/LowLevel/WorkbookReader.cs index a3685f1e6..a9983f084 100644 --- a/NanoXLSX/LowLevel/WorkbookReader.cs +++ b/NanoXLSX/LowLevel/WorkbookReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/WorksheetReader.cs b/NanoXLSX/LowLevel/WorksheetReader.cs index 16f4bc64b..d0b5be26b 100644 --- a/NanoXLSX/LowLevel/WorksheetReader.cs +++ b/NanoXLSX/LowLevel/WorksheetReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/XlsxReader.cs b/NanoXLSX/LowLevel/XlsxReader.cs index fa9dd6104..7f8b78a1e 100644 --- a/NanoXLSX/LowLevel/XlsxReader.cs +++ b/NanoXLSX/LowLevel/XlsxReader.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/LowLevel/XlsxWriter.cs b/NanoXLSX/LowLevel/XlsxWriter.cs index 598ad8c84..162ef09f0 100644 --- a/NanoXLSX/LowLevel/XlsxWriter.cs +++ b/NanoXLSX/LowLevel/XlsxWriter.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Metadata.cs b/NanoXLSX/Metadata.cs index 5e1d66f4e..2741d86ff 100644 --- a/NanoXLSX/Metadata.cs +++ b/NanoXLSX/Metadata.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/NanoXLSX.csproj b/NanoXLSX/NanoXLSX.csproj index 56e8fd8b5..a6150719c 100644 --- a/NanoXLSX/NanoXLSX.csproj +++ b/NanoXLSX/NanoXLSX.csproj @@ -9,7 +9,7 @@ NanoXLSX Raphael Stoeckli Raphael Stoeckli - Copyright Raphael Stoeckli © 2024 + Copyright Raphael Stoeckli © 2025 NanoXLSX is a library to generate and read Microsoft Excel files (XLSX) in an easy and native way https://github.com/rabanti-github/NanoXLSX https://github.com/rabanti-github/NanoXLSX.git @@ -23,9 +23,9 @@ Please see https://github.com/rabanti-github/NanoXLSX/blob/master/Changelog.md for the release notes MIT - 2.5.2 - 2.5.2.0 - 2.5.2.0 + 2.6.0 + 2.6.0.0 + 2.6.0.0 git True diff --git a/NanoXLSX/Range.cs b/NanoXLSX/Range.cs index da0a83288..65ada7e4a 100644 --- a/NanoXLSX/Range.cs +++ b/NanoXLSX/Range.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Shortener.cs b/NanoXLSX/Shortener.cs index f947eea32..a62c67278 100644 --- a/NanoXLSX/Shortener.cs +++ b/NanoXLSX/Shortener.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/AbstractStyle.cs b/NanoXLSX/Styles/AbstractStyle.cs index c561de0af..5d57e8959 100644 --- a/NanoXLSX/Styles/AbstractStyle.cs +++ b/NanoXLSX/Styles/AbstractStyle.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/AppendAttribute.cs b/NanoXLSX/Styles/AppendAttribute.cs index eeb4b2e40..e8a082553 100644 --- a/NanoXLSX/Styles/AppendAttribute.cs +++ b/NanoXLSX/Styles/AppendAttribute.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/BasicStyles.cs b/NanoXLSX/Styles/BasicStyles.cs index ca1645082..dac36f967 100644 --- a/NanoXLSX/Styles/BasicStyles.cs +++ b/NanoXLSX/Styles/BasicStyles.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/Border.cs b/NanoXLSX/Styles/Border.cs index 6426db338..b87314d05 100644 --- a/NanoXLSX/Styles/Border.cs +++ b/NanoXLSX/Styles/Border.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/CellXf.cs b/NanoXLSX/Styles/CellXf.cs index 78d4fffb0..3a7238967 100644 --- a/NanoXLSX/Styles/CellXf.cs +++ b/NanoXLSX/Styles/CellXf.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/Fill.cs b/NanoXLSX/Styles/Fill.cs index 3f7b52d43..ea2f5a7b1 100644 --- a/NanoXLSX/Styles/Fill.cs +++ b/NanoXLSX/Styles/Fill.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/Font.cs b/NanoXLSX/Styles/Font.cs index bc2ad6d5d..0c6105535 100644 --- a/NanoXLSX/Styles/Font.cs +++ b/NanoXLSX/Styles/Font.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/NumberFormat.cs b/NanoXLSX/Styles/NumberFormat.cs index d09de0856..78e56b5db 100644 --- a/NanoXLSX/Styles/NumberFormat.cs +++ b/NanoXLSX/Styles/NumberFormat.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/Style.cs b/NanoXLSX/Styles/Style.cs index f60ba1043..0b51baedf 100644 --- a/NanoXLSX/Styles/Style.cs +++ b/NanoXLSX/Styles/Style.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/StyleManager.cs b/NanoXLSX/Styles/StyleManager.cs index df2ea8be8..675e40566 100644 --- a/NanoXLSX/Styles/StyleManager.cs +++ b/NanoXLSX/Styles/StyleManager.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Styles/StyleRepository.cs b/NanoXLSX/Styles/StyleRepository.cs index 6f87c334b..78e0ad4f5 100644 --- a/NanoXLSX/Styles/StyleRepository.cs +++ b/NanoXLSX/Styles/StyleRepository.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Utils.cs b/NanoXLSX/Utils.cs index 21ccc2eed..145d27064 100644 --- a/NanoXLSX/Utils.cs +++ b/NanoXLSX/Utils.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Workbook.cs b/NanoXLSX/Workbook.cs index 54f6792d1..431f2f9aa 100644 --- a/NanoXLSX/Workbook.cs +++ b/NanoXLSX/Workbook.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ diff --git a/NanoXLSX/Worksheet.cs b/NanoXLSX/Worksheet.cs index f10084eea..25ca5b020 100644 --- a/NanoXLSX/Worksheet.cs +++ b/NanoXLSX/Worksheet.cs @@ -1,6 +1,6 @@ /* * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way - * Copyright Raphael Stoeckli © 2024 + * Copyright Raphael Stoeckli © 2025 * This library is licensed under the MIT License. * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT */ @@ -1423,6 +1423,171 @@ private int GetMinRow(int cellBoundary, int heightBoundary, int hiddenBoundary) } #endregion + #region Insert-Search-Replace + + /// + /// Inserts 'count' rows below the specified 'rowNumber'. Existing cells are moved down by the number of new rows. + /// The inserted, new rows inherits the style of the original cell at the defined row number. + /// The inserted cells are empty. The values can be set later + /// + /// Formulas / references are not adjusted + /// Row number below which the new row(s) will be inserted. + /// Number of rows to insert. + public void InsertRow(int rowNumber, int numberOfNewRows) + { + // All cells below the first row must receive a new address (row + count); + var upperRow = this.GetRow(rowNumber); + + // Identify all cells below the insertion point to adjust their addresses + var cellsToChange = this.Cells.Where(c => c.Value.CellAddress2.Row > rowNumber).ToList(); + + // Make a copy of the cells to be moved and then delete the original cells; + Dictionary newCells = new Dictionary(); + foreach (var cell in cellsToChange) + { + var row = cell.Value.CellAddress2.Row; + var col = cell.Value.CellAddress2.Column; + Address newAddress = new Address(col, row + numberOfNewRows); + + Cell newCell = new Cell(cell.Value.Value, cell.Value.DataType, newAddress); + if (cell.Value.CellStyle != null) + { + newCell.SetStyle(cell.Value.CellStyle); // Apply the style from the "old" cell. + } + newCells.Add(newAddress.GetAddress(), newCell); + + // Delete the original cells since the key cannot be changed. + this.Cells.Remove(cell.Key); + } + + // Fill the gap with new cells, using the same style as the first row. + foreach (Cell cell in upperRow) + { + for (int i = 0; i < numberOfNewRows; i++) + { + Address newAddress = new Address(cell.CellAddress2.Column, cell.CellAddress2.Row + 1 + i); + Cell newCell = new Cell(null, Cell.CellType.EMPTY, newAddress); + if (cell.CellStyle != null) + newCell.SetStyle(cell.CellStyle); + this.Cells.Add(newAddress.GetAddress(), newCell); + } + } + + // Re-add the previous cells from the copy back with a new key. + foreach (KeyValuePair cellKeyValue in newCells) + { + this.Cells.Add(cellKeyValue.Key, cellKeyValue.Value); //cell.Value is the cell incl. Style etc. + } + } + + /// + /// Inserts 'count' columns right of the specified 'columnNumber'. Existing cells are moved to the right by the number of new columns. + /// The inserted, new columns inherits the style of the original cell at the defined column number. + /// The inserted cells are empty. The values can be set later + /// + /// Formulas are not adjusted + /// Column number right which the new column(s) will be inserted. + /// Number of columns to insert. + public void InsertColumn(int columnNumber, int numberOfNewColumns) + { + var leftColumn = this.GetColumn(columnNumber); + var cellsToChange = this.Cells.Where(c => c.Value.CellAddress2.Column > columnNumber).ToList(); + + Dictionary newCells = new Dictionary(); + foreach (var cell in cellsToChange) + { + var row = cell.Value.CellAddress2.Row; + var col = cell.Value.CellAddress2.Column; + Address newAddress = new Address(col + numberOfNewColumns, row); + + Cell newCell = new Cell(cell.Value.Value, cell.Value.DataType, newAddress); + if (cell.Value.CellStyle != null) + { + newCell.SetStyle(cell.Value.CellStyle); // Apply the style from the "old" cell. + } + newCells.Add(newAddress.GetAddress(), newCell); + + // Delete the original cells since the key cannot be changed. + this.Cells.Remove(cell.Key); + } + + // Fill the gap with new cells, using the same style as the first row. + foreach (Cell cell in leftColumn) + { + for (int i = 0; i < numberOfNewColumns; i++) + { + Address newAddress = new Address(cell.CellAddress2.Column + 1 + i, cell.CellAddress2.Row); + Cell newCell = new Cell(null, Cell.CellType.EMPTY, newAddress); + if (cell.CellStyle != null) + newCell.SetStyle(cell.CellStyle); + this.Cells.Add(newAddress.GetAddress(), newCell); + } + } + + // Re-add the previous cells from the copy back with a new key. + foreach (KeyValuePair cellKeyValue in newCells) + { + this.Cells.Add(cellKeyValue.Key, cellKeyValue.Value); //cell.Value is the cell incl. Style etc. + } + } + + /// + /// Searches for the first occurrence of the value. + /// + /// The value to search for. + /// The first cell containing the searched value or null if the value was not found + public Cell FirstCellByValue(object searchValue) + { + var cell = this.Cells.FirstOrDefault(c => + Equals(c.Value.Value, searchValue)) + .Value; + return cell; + } + + /// + /// Searches for the first occurrence of the expression. + /// Example: var cell = worksheet.FindCell(c => c.Value?.ToString().Contains("searchValue")); + /// + /// + /// The first cell containing the searched value or null if the value was not found + public Cell FirstOrDefaultCell(Func predicate) + { + return this.Cells.Values + .FirstOrDefault(c => c != null && (c.Value == null || predicate(c))); + } + + /// + /// Searches for cells that contain the specified value and returns a list of these cells. + /// + /// The value to search for. + /// A list of cells that contain the specified value. + public List CellsByValue(object searchValue) + { + return this.Cells.Where(c => + Equals(c.Value.Value, searchValue)) + .Select(c => c.Value) + .ToList(); + } + + /// + /// Replaces all occurrences of 'oldValue' with 'newValue' and returns the number of replacements. + /// + /// Old value + /// New value that should replace the old one + /// Count of replaced Cell values + public int ReplaceCellValue(object oldValue, object newValue) + { + int count = 0; + List foundCells = this.CellsByValue(oldValue); + foreach (var cell in foundCells) + { + cell.Value = newValue; + count++; + } + return count; + } + #endregion + #region common_methods /// @@ -2629,171 +2794,5 @@ private static bool WorksheetExists(string name, Workbook workbook) #endregion - #region Insert-Search-Replace - - /// - /// Inserts 'count' rows below the specified 'rowNumber'. Existing cells are moved down by the number of new rows. - /// The inserted, new rows inherits the style of the original cell at the defined row number. - /// The inserted cells are empty. The values can be set later - /// - /// Formulas / references are not adjusted - /// Row number below which the new row(s) will be inserted. - /// Number of rows to insert. - public void InsertRow(int rowNumber, int numberOfNewRows) - { - // All cells below the first row must receive a new address (row + count); - var upperRow = this.GetRow(rowNumber); - - // Identify all cells below the insertion point to adjust their addresses - var cellsToChange = this.Cells.Where(c => c.Value.CellAddress2.Row > rowNumber).ToList(); - - // Make a copy of the cells to be moved and then delete the original cells; - Dictionary newCells = new Dictionary(); - foreach (var cell in cellsToChange) - { - var row = cell.Value.CellAddress2.Row; - var col = cell.Value.CellAddress2.Column; - Address newAddress = new Address(col, row + numberOfNewRows); - - Cell newCell = new Cell(cell.Value.Value, cell.Value.DataType, newAddress); - if (cell.Value.CellStyle != null) - { - newCell.SetStyle(cell.Value.CellStyle); // Apply the style from the "old" cell. - } - newCells.Add(newAddress.GetAddress(), newCell); - - // Delete the original cells since the key cannot be changed. - this.Cells.Remove(cell.Key); - } - - // Fill the gap with new cells, using the same style as the first row. - foreach (Cell cell in upperRow) - { - for (int i = 0; i < numberOfNewRows; i++) - { - Address newAddress = new Address(cell.CellAddress2.Column, cell.CellAddress2.Row + 1 + i); - Cell newCell = new Cell(null, Cell.CellType.EMPTY, newAddress); - if (cell.CellStyle != null) - newCell.SetStyle(cell.CellStyle); - this.Cells.Add(newAddress.GetAddress(), newCell); - } - } - - // Re-add the previous cells from the copy back with a new key. - foreach (KeyValuePair cellKeyValue in newCells) - { - this.Cells.Add(cellKeyValue.Key, cellKeyValue.Value); //cell.Value is the cell incl. Style etc. - } - } - - /// - /// Inserts 'count' columns right of the specified 'columnNumber'. Existing cells are moved to the right by the number of new columns. - /// The inserted, new columns inherits the style of the original cell at the defined column number. - /// The inserted cells are empty. The values can be set later - /// - /// Formulas are not adjusted - /// Column number right which the new column(s) will be inserted. - /// Number of columns to insert. - public void InsertColumn(int columnNumber, int numberOfNewColumns) - { - var leftColumn = this.GetColumn(columnNumber); - var cellsToChange = this.Cells.Where(c => c.Value.CellAddress2.Column > columnNumber).ToList(); - - Dictionary newCells = new Dictionary(); - foreach (var cell in cellsToChange) - { - var row = cell.Value.CellAddress2.Row; - var col = cell.Value.CellAddress2.Column; - Address newAddress = new Address(col + numberOfNewColumns, row); - - Cell newCell = new Cell(cell.Value.Value, cell.Value.DataType, newAddress); - if (cell.Value.CellStyle != null) - { - newCell.SetStyle(cell.Value.CellStyle); // Apply the style from the "old" cell. - } - newCells.Add(newAddress.GetAddress(), newCell); - - // Delete the original cells since the key cannot be changed. - this.Cells.Remove(cell.Key); - } - - // Fill the gap with new cells, using the same style as the first row. - foreach (Cell cell in leftColumn) - { - for (int i = 0; i < numberOfNewColumns; i++) - { - Address newAddress = new Address(cell.CellAddress2.Column + 1 + i, cell.CellAddress2.Row); - Cell newCell = new Cell(null, Cell.CellType.EMPTY, newAddress); - if (cell.CellStyle != null) - newCell.SetStyle(cell.CellStyle); - this.Cells.Add(newAddress.GetAddress(), newCell); - } - } - - // Re-add the previous cells from the copy back with a new key. - foreach (KeyValuePair cellKeyValue in newCells) - { - this.Cells.Add(cellKeyValue.Key, cellKeyValue.Value); //cell.Value is the cell incl. Style etc. - } - } - - /// - /// Searches for the first occurrence of the value. - /// - /// The value to search for. - /// The first cell containing the searched value or null if the value was not found - public Cell FirstCellByValue(object searchValue) - { - var cell = this.Cells.FirstOrDefault(c => - Equals(c.Value.Value, searchValue)) - .Value; - return cell; - } - - /// - /// Searches for the first occurrence of the expression. - /// Example: var cell = worksheet.FindCell(c => c.Value?.ToString().Contains("searchValue")); - /// - /// - /// The first cell containing the searched value or null if the value was not found - public Cell FirstOrDefaultCell(Func predicate) - { - return this.Cells.Values - .FirstOrDefault(c => c != null && (c.Value == null || predicate(c))); - } - - /// - /// Searches for cells that contain the specified value and returns a list of these cells. - /// - /// The value to search for. - /// A list of cells that contain the specified value. - public List CellsByValue(object searchValue) - { - return this.Cells.Where(c => - Equals(c.Value.Value, searchValue)) - .Select(c => c.Value) - .ToList(); - } - - /// - /// Replaces all occurrences of 'oldValue' with 'newValue' and returns the number of replacements. - /// - /// Old value - /// New value that should replace the old one - /// Count of replaced Cell values - public int ReplaceCellValue(object oldValue, object newValue) - { - int count = 0; - List foundCells = this.CellsByValue(oldValue); - foreach (var cell in foundCells) - { - cell.Value = newValue; - count++; - } - return count; - } } - #endregion - - } diff --git a/NanoXlsx Test/NanoXLSX Test.csproj b/NanoXlsx Test/NanoXLSX Test.csproj index 7a56a0d1f..77b7e619f 100644 --- a/NanoXlsx Test/NanoXLSX Test.csproj +++ b/NanoXlsx Test/NanoXLSX Test.csproj @@ -9,7 +9,7 @@ NanoXLSX Unit Tests for NanoXLSX MIT - Copyright Raphael Stoeckli © 2024 + Copyright Raphael Stoeckli © 2025 https://github.com/rabanti-github/NanoXLSX NanoXLSX.png @@ -17,9 +17,9 @@ Excel Office XLSX git Please see https://github.com/rabanti-github/NanoXLSX/blob/master/Changelog.md for the release notes - 2.5.2 - 2.5.2.0 - 2.5.2.0 + 2.6.0 + 2.6.0.0 + 2.6.0.0