Skip to content

Commit

Permalink
Merge pull request #27 from fahadadeel/main
Browse files Browse the repository at this point in the history
Upgrade Open XML SDK to version 3.2.0
  • Loading branch information
fahadadeel authored Jan 20, 2025
2 parents 82364f4 + 49ea78b commit 16ab6fa
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 20 deletions.
10 changes: 0 additions & 10 deletions CLA.md

This file was deleted.

2 changes: 1 addition & 1 deletion FileFormat.Cells/FileFormat.Cells.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@


<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions FileFormat.Cells/Workbook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ public void Save()
public void Save(string filePath)
{
this.workbookpart.Workbook.Save();
this.spreadsheetDocument.Close();
this.spreadsheetDocument.Dispose();

File.WriteAllBytes(filePath, this.ms.ToArray()); // Write the MemoryStream back to the file
}
Expand All @@ -663,7 +663,7 @@ public void Save(Stream stream)

var clonedDocument = this.spreadsheetDocument.Clone(stream);
workbookpart.Workbook.Save();
spreadsheetDocument.Close();
spreadsheetDocument.Dispose();
stream.Close();

}
Expand Down
15 changes: 10 additions & 5 deletions FileFormat.Cells/Worksheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -827,18 +827,23 @@ private ValidationRule CreateValidationRuleFromDataValidation(DataValidation dat

private ValidationType DetermineValidationType(DataValidationValues openXmlType)
{
var values = Enum.GetNames(typeof(DataValidationValues));
Console.WriteLine("Available DataValidationValues:");
foreach (var value in values)
{
Console.WriteLine(value);
}
// Map the OpenXML DataValidationValues to your ValidationType enum
// This mapping depends on how closely your ValidationType enum aligns with OpenXML's types
// Example mapping:
switch (openXmlType)
switch (openXmlType.ToString()) // If DataValidationValues is now a string enum
{
case DataValidationValues.List:
case "List":
return ValidationType.List;
case DataValidationValues.Custom:
case "Custom":
return ValidationType.CustomFormula;
// Map other types...
default:
throw new NotImplementedException("Validation type not supported.");
throw new NotImplementedException($"Validation type '{openXmlType}' not supported.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion FileFormat.Cells_Tests/FileFormat.Cells_Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Aspose Pty Ltd
Copyright (c) 2025 Aspose Pty Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 16ab6fa

Please sign in to comment.