Skip to content

Commit f307095

Browse files
Merge branch 'master' into dev-pr
2 parents d4b5b2d + 150c515 commit f307095

1,083 files changed

Lines changed: 1146 additions & 1129 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Changelog.md

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

3+
## v2.6.3
4+
5+
---
6+
Release Date: **26.04.2025**
7+
8+
- Fixed a bug that prevented adding new worksheets when a pane split was defined
9+
- Changed handling of reading workbooks, when docProps are missing (formal change)
10+
- Added test case
11+
12+
313
## v2.6.2
414

515
---

Demo/Demo.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1616
<TargetFrameworks>net45;net5.0</TargetFrameworks>
1717
<StartupObject>Demo.Program</StartupObject>
18-
<Version>2.6.2</Version>
19-
<AssemblyVersion>2.6.2.0</AssemblyVersion>
20-
<FileVersion>2.6.2.0</FileVersion>
18+
<Version>2.6.3</Version>
19+
<AssemblyVersion>2.6.3.0</AssemblyVersion>
20+
<FileVersion>2.6.3.0</FileVersion>
2121
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
<PackageTags>XLSX Excel ExcelWriter ExcelReader Office</PackageTags>

NanoXLSX/LowLevel/MetadataReader.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,12 @@ public class MetadataReader
6969

7070
#region methods
7171
/// <summary>
72-
/// Reads the XML file form the passed stream and processes the AppData section
72+
/// Reads the XML file form the passed stream and processes the AppData section. The existence of the stream should be checked previously
7373
/// </summary>
7474
/// <param name="stream">Stream of the XML file</param>
7575
/// <exception cref="Exceptions.IOException">Throws IOException in case of an error</exception>
7676
public void ReadAppData(MemoryStream stream)
7777
{
78-
if (stream == null)
79-
{
80-
// No metadata available in xlsx file
81-
return;
82-
}
8378
try
8479
{
8580
using (stream) // Close after processing
@@ -119,17 +114,12 @@ public void ReadAppData(MemoryStream stream)
119114
}
120115

121116
/// <summary>
122-
/// Reads the XML file form the passed stream and processes the Core section
117+
/// Reads the XML file form the passed stream and processes the Core section. The existence of the stream should be checked previously
123118
/// </summary>
124119
/// <param name="stream">Stream of the XML file</param>
125120
/// <exception cref="Exceptions.IOException">Throws IOException in case of an error</exception>
126121
public void ReadCoreData(MemoryStream stream)
127122
{
128-
if (stream == null)
129-
{
130-
// No metadata available in xlsx file
131-
return;
132-
}
133123
try
134124
{
135125
using (stream) // Close after processing

NanoXLSX/LowLevel/XlsxReader.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,15 @@ private void ReadZip(ZipArchive zf)
338338

339339
metadataReader = new MetadataReader();
340340
ms = GetEntryStream("docProps/app.xml", zf);
341-
metadataReader.ReadAppData(ms);
341+
if (ms != null && ms.Length > 0) // If null/length == 0, no docProps/app.xml seems to be defined
342+
{
343+
metadataReader.ReadAppData(ms);
344+
}
342345
ms = GetEntryStream("docProps/core.xml", zf);
343-
metadataReader.ReadCoreData(ms);
346+
if (ms != null && ms.Length > 0) // If null/length == 0, no docProps/core.xml seems to be defined
347+
{
348+
metadataReader.ReadCoreData(ms);
349+
}
344350

345351
int worksheetIndex = 1;
346352
string name;

NanoXLSX/LowLevel/XlsxWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private string CreateWorkbookDocument()
213213
{
214214
StringBuilder sb = new StringBuilder();
215215
sb.Append("<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">");
216-
if (workbook.SelectedWorksheet > 0 || workbook.Hidden)
216+
if (workbook.SelectedWorksheet > 0 || workbook.Hidden || workbook.Worksheets.Any(x => HasPaneSplitting(x)))
217217
{
218218
sb.Append("<bookViews><workbookView ");
219219
if (workbook.Hidden)

NanoXLSX/NanoXLSX.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
<PackageLicenseFile></PackageLicenseFile>
2424
<PackageReleaseNotes>Please see https://github.com/rabanti-github/NanoXLSX/blob/master/Changelog.md for the release notes</PackageReleaseNotes>
2525
<PackageLicenseExpression>MIT</PackageLicenseExpression>
26-
<Version>2.6.2</Version>
27-
<AssemblyVersion>2.6.2.0</AssemblyVersion>
28-
<FileVersion>2.6.2.0</FileVersion>
26+
<Version>2.6.3</Version>
27+
<AssemblyVersion>2.6.3.0</AssemblyVersion>
28+
<FileVersion>2.6.3.0</FileVersion>
2929
<RepositoryType>git</RepositoryType>
3030
<GenerateDocumentationFile>True</GenerateDocumentationFile>
3131
</PropertyGroup>

NanoXlsx Test/NanoXLSX Test.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<PackageTags>Excel Office XLSX</PackageTags>
1818
<RepositoryType>git</RepositoryType>
1919
<PackageReleaseNotes>Please see https://github.com/rabanti-github/NanoXLSX/blob/master/Changelog.md for the release notes</PackageReleaseNotes>
20-
<Version>2.6.2</Version>
21-
<AssemblyVersion>2.6.2.0</AssemblyVersion>
22-
<FileVersion>2.6.2.0</FileVersion>
20+
<Version>2.6.3</Version>
21+
<AssemblyVersion>2.6.3.0</AssemblyVersion>
22+
<FileVersion>2.6.3.0</FileVersion>
2323
</PropertyGroup>
2424
<ItemGroup>
2525
<None Remove="Resources\autofilter.xlsx" />
@@ -35,6 +35,7 @@
3535
<None Remove="Resources\invalid_workbook.xlsx" />
3636
<None Remove="Resources\invalid_workbook_sheet-definition.xlsx" />
3737
<None Remove="Resources\invalid_worksheet.xlsx" />
38+
<None Remove="Resources\missing_DocProps.xlsx" />
3839
<None Remove="Resources\missing_worksheet.xlsx" />
3940
<None Remove="Resources\new_format.xlsx" />
4041
<None Remove="Resources\omitted_style_refs.xlsx" />
@@ -57,6 +58,7 @@
5758
<EmbeddedResource Include="Resources\invalid_workbook.xlsx" />
5859
<EmbeddedResource Include="Resources\invalid_workbook_sheet-definition.xlsx" />
5960
<EmbeddedResource Include="Resources\invalid_worksheet.xlsx" />
61+
<EmbeddedResource Include="Resources\missing_docProps.xlsx" />
6062
<EmbeddedResource Include="Resources\semi-large-amount.xlsx" />
6163
<EmbeddedResource Include="Resources\missing_worksheet.xlsx">
6264
<CopyToOutputDirectory>Never</CopyToOutputDirectory>

NanoXlsx Test/Reader/ReadDataTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,15 @@ public async Task FailingAsyncReadInvalidDataTest(string invalidFile)
405405
await Assert.ThrowsAsync<NanoXLSX.Exceptions.IOException>(() => Workbook.LoadAsync(stream));
406406
}
407407

408+
[Fact(DisplayName = "Test of the reader functionality on missing docProps documents (should not crash)")]
409+
public void ReadMissingDocPropsTest()
410+
{
411+
Stream stream = TestUtils.GetResource("missing_docProps.xlsx");
412+
Workbook workbook = Workbook.Load(stream);
413+
Assert.Single(workbook.Worksheets);
414+
Assert.NotNull(workbook.WorkbookMetadata);
415+
}
416+
408417
[Fact(DisplayName = "Test of the workbook reader if the only workbook entry is a chart")]
409418
public void ReadChartsheetTest()
410419
{
4.5 KB
Binary file not shown.

docs/Documentation.chm

72 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)