From f7ff5dc63eddf0ccda4b03d5a12b8cbe159d6f73 Mon Sep 17 00:00:00 2001 From: justkawal <49296873+justkawal@users.noreply.github.com> Date: Sat, 16 Mar 2024 06:17:10 -0400 Subject: [PATCH] Fix Rename and Delete sheet issues (#333) --- CHANGELOG.md | 3 ++- lib/src/save/save_file.dart | 10 +++++++--- lib/src/utilities/colors.dart | 6 ------ pubspec.yaml | 4 ++-- test/excel_test.dart | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55e8bfca..e0e9113b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [4.0.3] +- Fix Archive version ## [4.0.2] - 2023-12-23 diff --git a/lib/src/save/save_file.dart b/lib/src/save/save_file.dart index 643e82b1..b6df9dec 100644 --- a/lib/src/save/save_file.dart +++ b/lib/src/save/save_file.dart @@ -497,9 +497,13 @@ class Save { int count; if (numFmtsElement == null) { numFmtsElement = XmlElement(XmlName('numFmts')); - ///FIX: if no default numFormats were added in styles.xml - customNumFormats were added in wrong place, - styleSheet.findElements('styleSheet').first.children - .insert(0,numFmtsElement); + + ///FIX: if no default numFormats were added in styles.xml - customNumFormats were added in wrong place, + styleSheet + .findElements('styleSheet') + .first + .children + .insert(0, numFmtsElement); // styleSheet.children.insert(0, numFmtsElement); } count = int.parse(numFmtsElement.getAttribute('count') ?? '0'); diff --git a/lib/src/utilities/colors.dart b/lib/src/utilities/colors.dart index 4aeddb86..c58c3785 100644 --- a/lib/src/utilities/colors.dart +++ b/lib/src/utilities/colors.dart @@ -77,15 +77,12 @@ extension StringExt on String { ExcelColor get excelColor => this == 'none' ? ExcelColor.none : _assertHexString(this) - ? ExcelColor.valuesAsMap[this] ?? ExcelColor._(this) - : ExcelColor.black; } /// Copying from Flutter Material Color class ExcelColor extends Equatable { - const ExcelColor._(this._color, [this._name, this._type]); final String _color; @@ -104,7 +101,6 @@ class ExcelColor extends Equatable { String? get name => _name; - /// Warning! Highly unsafe method. /// Can break your excel file if you do not know what you are doing factory ExcelColor.fromInt(int colorIntValue) => @@ -115,10 +111,8 @@ class ExcelColor extends Equatable { factory ExcelColor.fromHexString(String colorHexValue) => ExcelColor._(colorHexValue); - static const none = ExcelColor._('none'); - static const black = ExcelColor._('FF000000', 'black', ColorType.color); static const black12 = ExcelColor._('1F000000', 'black12', ColorType.color); static const black26 = ExcelColor._('42000000', 'black26', ColorType.color); diff --git a/pubspec.yaml b/pubspec.yaml index 3535d439..1a418339 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: excel description: A flutter and dart library for reading, creating, editing and updating excel sheets with compatible both on client and server side. -version: 4.0.2 +version: 4.0.3 homepage: https://github.com/justkawal/excel topics: - excel @@ -13,7 +13,7 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - archive: ^3.0.0 + archive: 3.4.9 xml: ">=5.0.0 <7.0.0" collection: ^1.15.0 equatable: ^2.0.0 diff --git a/test/excel_test.dart b/test/excel_test.dart index 7e47890c..65153706 100644 --- a/test/excel_test.dart +++ b/test/excel_test.dart @@ -253,8 +253,8 @@ void main() { sheet.updateCell(CellIndex.indexByString('A1'), DoubleCellValue(0.15), cellStyle: styleA1); - sheet.updateCell( - CellIndex.indexByString('B1'), DoubleCellValue(123456.789), cellStyle: styleB1); + sheet.updateCell(CellIndex.indexByString('B1'), DoubleCellValue(123456.789), + cellStyle: styleB1); final bytes = excel.encode(); final excel2 = Excel.decodeBytes(bytes!); final sheet2 = excel2['Sheet1'];