Skip to content

Commit

Permalink
Fix Rename and Delete sheet issues (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
justkawal authored Mar 16, 2024
1 parent 0ebc4be commit f7ff5dc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 7 additions & 3 deletions lib/src/save/save_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 0 additions & 6 deletions lib/src/utilities/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) =>
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/excel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit f7ff5dc

Please sign in to comment.