Skip to content

Commit 5d1fa56

Browse files
Merge branch 'dev'
2 parents 11d845b + 4196bd6 commit 5d1fa56

18 files changed

Lines changed: 66 additions & 28 deletions

File tree

Changelog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## v3.0.1
4+
5+
---
6+
7+
Release Date: **(24.04.2026)** <sup>(DMY)</sup>
8+
9+
- Package: **NanoXLSX.Reader**
10+
* Fixed internal async handling of the workbook reader, to avoid deadlocks in WinForms/WPF projects, when async is not used (regression).
11+
* Fixed order of worksheets when manually changed
12+
* Added filename to workbook when reading from file
13+
14+
315
## v3.0.0
416

517
---
@@ -246,7 +258,7 @@ Release Date: **12.01.2025** <sup>(DMY)</sup>
246258
Release Date: **24.11.2024** <sup>(DMY)</sup>
247259

248260
- Fixed a bug of the column address (letter) resolution. Column letters above 'Z' were resolved incorrectly
249-
- Changed async handing of the workbook reader, to avoid deadlocks. Change provided by Jarren Long
261+
- Changed async handling of the workbook reader, to avoid deadlocks. Change provided by Jarren Long
250262
- Simplified project structure (unified .Net 4.x and Standard). Change provided by Jarren Long
251263
- Added tests for column address resolution
252264

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"packageName": "NanoXLSX",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "NanoXLSX is a library to generate and read Microsoft Excel files (XLSX) in an easy and native way. This package is the meta package of NanoXLSX and should be used in most cases as dependency in your project."
55
}

Documentation/icons/NanoXLSX.png

-3.03 KB
Binary file not shown.

NanoXLSX.Core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![NanoXLSX](https://raw.githubusercontent.com/rabanti-github/NanoXLSX/refs/heads/master/Documentation/icons/NanoXLSX.png)
1+
![NanoXLSX](https://raw.githubusercontent.com/rabanti-github/NanoXLSX/refs/heads/master/NanoXLSX/NanoXLSX.png)
22

33
# NanoXLSX.Core
44

NanoXLSX.Reader/Changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log - NanoXLSX.Reader
22

3+
## v3.0.1
4+
5+
---
6+
Release Date: **(24.04.2026)** <sup>(DMY)</sup>
7+
8+
- Fixed internal async handling of the workbook reader, to avoid deadlocks in WinForms/WPF projects, when async is not used (regression).
9+
- Fixed order of worksheets when manually changed
10+
- Added filename to workbook when reading from file
11+
12+
313
## v3.0.0
414

515
---
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJECT_NUMBER = 3.0.0
1+
PROJECT_NUMBER = 3.0.1

NanoXLSX.Reader/Extensions/WorkbookReader.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public static Workbook Load(string filename, ReaderOptions options = null)
3434
using (XlsxReader reader = new XlsxReader(filename, options))
3535
{
3636
reader.Read();
37+
reader.Workbook.Filename = filename;
3738
return reader.Workbook;
3839
}
3940
}
@@ -66,6 +67,7 @@ public static async Task<Workbook> LoadAsync(string filename, ReaderOptions opti
6667
using (XlsxReader reader = new XlsxReader(filename, options))
6768
{
6869
await reader.ReadAsync();
70+
reader.Workbook.Filename = filename;
6971
return reader.Workbook;
7072
}
7173
}

NanoXLSX.Reader/Internal/Readers/WorkbookReader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ private void GetViewInformation(XmlNodeList nodes)
175175
/// <param name="nodes">Sheet nodes to check</param>
176176
private void GetWorksheetInformation(XmlNodeList nodes)
177177
{
178+
int visibleWorksheetOrder = 0;
178179
foreach (XmlNode node in nodes)
179180
{
180181
if (node.LocalName.Equals("sheet", StringComparison.OrdinalIgnoreCase))
@@ -194,7 +195,8 @@ private void GetWorksheetInformation(XmlNodeList nodes)
194195
{
195196
Hidden = hidden
196197
};
197-
Workbook.AuxiliaryData.SetData(PlugInUUID.WorkbookReader, PlugInUUID.WorksheetDefinitionEntity, id, definition);
198+
Workbook.AuxiliaryData.SetData(PlugInUUID.WorkbookReader, PlugInUUID.WorksheetDefinitionEntity, visibleWorksheetOrder, definition);
199+
visibleWorksheetOrder++;
198200
}
199201
catch (Exception e)
200202
{

NanoXLSX.Reader/Internal/Readers/WorksheetReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void Execute()
105105
try
106106
{
107107
WorksheetDefinition worksheetDefinition = Workbook.AuxiliaryData.GetData<WorksheetDefinition>(PlugInUUID.WorkbookReader, PlugInUUID.WorksheetDefinitionEntity, CurrentWorksheetID);
108-
Worksheet worksheet = new Worksheet(worksheetDefinition.WorksheetName, CurrentWorksheetID, Workbook)
108+
Worksheet worksheet = new Worksheet(worksheetDefinition.WorksheetName, worksheetDefinition.SheetID, Workbook)
109109
{
110110
Hidden = worksheetDefinition.Hidden
111111
};
@@ -146,7 +146,7 @@ private void SetWorkbookRelation(Worksheet worksheet)
146146
{
147147
Workbook.AddWorksheet(worksheet);
148148
int selectedWorksheetId = Workbook.AuxiliaryData.GetData<int>(PlugInUUID.WorkbookReader, PlugInUUID.SelectedWorksheetEntity);
149-
if (selectedWorksheetId + 1 == CurrentWorksheetID) // selectedWorksheetId is 0-based
149+
if (selectedWorksheetId == CurrentWorksheetID)
150150
{
151151
Workbook.SetSelectedWorksheet(worksheet);
152152
}

NanoXLSX.Reader/Internal/Readers/XlsxReader.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void Read()
7777
{
7878
using (memoryStream = new MemoryStream())
7979
{
80-
ReadInternal().GetAwaiter().GetResult();
80+
Task.Run(() => ReadInternal()).GetAwaiter().GetResult();
8181
}
8282
}
8383
catch (NotSupportedContentException)
@@ -224,9 +224,10 @@ private void ReadZip(ZipArchive zf)
224224

225225
IWorksheetReader worksheetReader = PlugInLoader.GetPlugIn<IWorksheetReader>(PlugInUUID.WorksheetReader, new WorksheetReader());
226226
worksheetReader.SharedStrings = sharedStringsReader.SharedStrings;
227-
List<WorksheetDefinition> workshetDefinitions = wb.AuxiliaryData.GetDataList<WorksheetDefinition>(PlugInUUID.WorkbookReader, PlugInUUID.WorksheetDefinitionEntity);
228227
List<Relationship> relationshipDefinitions = wb.AuxiliaryData.GetDataList<Relationship>(PlugInUUID.RelationshipReader, PlugInUUID.RelationshipEntity);
229-
foreach (WorksheetDefinition definition in workshetDefinitions)
228+
int worksheetVisualIndex = 0;
229+
WorksheetDefinition definition;
230+
while ((definition = wb.AuxiliaryData.GetData<WorksheetDefinition>(PlugInUUID.WorkbookReader, PlugInUUID.WorksheetDefinitionEntity, worksheetVisualIndex)) != null)
230231
{
231232
Relationship relationship = relationshipDefinitions.SingleOrDefault(r => r.RID == definition.RelId);
232233
if (relationship == null)
@@ -235,8 +236,9 @@ private void ReadZip(ZipArchive zf)
235236
}
236237
ms = GetEntryStream(relationship.Target, zf);
237238
worksheetReader.Init(ms, wb, readerOptions, ReaderPlugInHandler.HandleInlineQueuePlugins);
238-
worksheetReader.CurrentWorksheetID = definition.SheetID;
239+
worksheetReader.CurrentWorksheetID = worksheetVisualIndex;
239240
worksheetReader.Execute();
241+
worksheetVisualIndex++;
240242
}
241243
if (wb.Worksheets.Count == 0)
242244
{

0 commit comments

Comments
 (0)