diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index cfa55f4..d742a6d 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,3 +12,11 @@ **Did this work in previous versions of our tool? Which versions?** - [ ] I attached a sample spreadsheet. (You can drag files on to this issue) + +**Code to reproduce problem:** +```c# +public void Main() +{ + // Where possible, post full code to reproduce your issue. +} +``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 891ee85..6856874 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,14 @@ -Fixes # . -Changes proposed in this pull request: - - - - - - - -How did I test this code: - - - - - - - -- [ ] I attached a sample spreadsheet. (You can drag files on to this pull request) +#### What's this PR do? +#### Where should the reviewer start? +#### How should this be manually tested? +#### Any background context you want to provide? + +#### Screenshots (if appropriate) +#### Questions: +- Is there a blog post? +- Does the knowledge base need an update? +- Does this add new (C#) dependencies? + +- [ ] C# Code Review: @csreviewer +- [ ] Test Automation Review: @csreviewer \ No newline at end of file diff --git a/ClosedXML.sln b/ClosedXML.sln index 4e94132..b58a074 100644 --- a/ClosedXML.sln +++ b/ClosedXML.sln @@ -1,60 +1,55 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Sandbox", "ClosedXML_Sandbox\ClosedXML_Sandbox.csproj", "{38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C94E22C-85AA-48FD-B082-CF929FFC6C31}" - ProjectSection(SolutionItems) = preProject - ClosedXML.vsmdi = ClosedXML.vsmdi - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Examples", "ClosedXML_Examples\ClosedXML_Examples.csproj", "{03A518D0-1CB7-488E-861C-C4E782B27A46}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Net3.5", "ClosedXML_Net3.5\ClosedXML_Net3.5.csproj", "{5F43B12B-A900-40C6-9924-A0C0B032F791}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML", "ClosedXML\ClosedXML.csproj", "{BD5E6BFE-E837-4A35-BCA9-39667D873A20}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Tests", "ClosedXML_Tests\ClosedXML_Tests.csproj", "{09B066ED-E4A7-4545-A1A4-FF03DD524BDF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{073CFB1C-43DC-4ADC-9D12-BB8D7B10C099}" - ProjectSection(SolutionItems) = preProject - .github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md - .github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.Build.0 = Release|Any CPU - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.ActiveCfg = Release|Any CPU - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.Build.0 = Release|Any CPU - {5F43B12B-A900-40C6-9924-A0C0B032F791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F43B12B-A900-40C6-9924-A0C0B032F791}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F43B12B-A900-40C6-9924-A0C0B032F791}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F43B12B-A900-40C6-9924-A0C0B032F791}.Release|Any CPU.Build.0 = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Any CPU.Build.0 = Release|Any CPU - {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = ClosedXML.vsmdi - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Sandbox", "ClosedXML_Sandbox\ClosedXML_Sandbox.csproj", "{38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C94E22C-85AA-48FD-B082-CF929FFC6C31}" + ProjectSection(SolutionItems) = preProject + appveyor.yml = appveyor.yml + ClosedXML.vsmdi = ClosedXML.vsmdi + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Examples", "ClosedXML_Examples\ClosedXML_Examples.csproj", "{03A518D0-1CB7-488E-861C-C4E782B27A46}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML", "ClosedXML\ClosedXML.csproj", "{BD5E6BFE-E837-4A35-BCA9-39667D873A20}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Tests", "ClosedXML_Tests\ClosedXML_Tests.csproj", "{09B066ED-E4A7-4545-A1A4-FF03DD524BDF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{073CFB1C-43DC-4ADC-9D12-BB8D7B10C099}" + ProjectSection(SolutionItems) = preProject + .github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md + .github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.Build.0 = Release|Any CPU + {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.Build.0 = Release|Any CPU + {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Any CPU.Build.0 = Release|Any CPU + {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {09B066ED-E4A7-4545-A1A4-FF03DD524BDF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = ClosedXML.vsmdi + EndGlobalSection +EndGlobal diff --git a/ClosedXML/ClosedXML.csproj b/ClosedXML/ClosedXML.csproj index 84c5f14..d5ddc65 100644 --- a/ClosedXML/ClosedXML.csproj +++ b/ClosedXML/ClosedXML.csproj @@ -10,9 +10,8 @@ Properties ClosedXML ClosedXML - v4.0 + v4.5.2 512 - Client ..\ true @@ -26,6 +25,7 @@ prompt 4 1591 + false pdbonly @@ -37,6 +37,7 @@ 4 bin\Release\ClosedXML.xml 1591 + false true @@ -45,9 +46,9 @@ ClosedXML.snk - + + ..\packages\DocumentFormat.OpenXml.2.7.1\lib\net45\DocumentFormat.OpenXml.dll True - ..\packages\DocumentFormat.OpenXml.2.5\lib\DocumentFormat.OpenXml.dll ..\packages\FastMember.Signed.1.1.0\lib\net40\FastMember.Signed.dll diff --git a/ClosedXML/Excel/CalcEngine/XLCalcEngine.cs b/ClosedXML/Excel/CalcEngine/XLCalcEngine.cs index e7457e2..6686621 100644 --- a/ClosedXML/Excel/CalcEngine/XLCalcEngine.cs +++ b/ClosedXML/Excel/CalcEngine/XLCalcEngine.cs @@ -27,14 +27,36 @@ { if (identifier.Contains("!") && _wb != null) { - var wsName = identifier.Substring(0, identifier.IndexOf("!")); - return new CellRangeReference(_wb.Worksheet(wsName).Range(identifier.Substring(identifier.IndexOf("!") + 1)), this); + var referencedSheetNames = identifier.Split(':') + .Select(part => + { + if (part.Contains("!")) + return part.Substring(0, part.IndexOf('!')).ToLower(); + else + return null; + }) + .Where(sheet => sheet != null) + .Distinct(); + + if (!referencedSheetNames.Any()) + return new CellRangeReference(_ws.Range(identifier), this); + else if (referencedSheetNames.Count() > 1) + throw new ArgumentOutOfRangeException(referencedSheetNames.Last(), "Cross worksheet references may references no more than 1 other worksheet"); + else + { + IXLWorksheet worksheet; + if (!_wb.TryGetWorksheet(referencedSheetNames.Single(), out worksheet)) + throw new ArgumentOutOfRangeException(referencedSheetNames.Single(), "The required worksheet cannot be found"); + + identifier = identifier.ToLower().Replace(string.Format("{0}!", worksheet.Name.ToLower()), ""); + + return new CellRangeReference(worksheet.Range(identifier), this); + } } - - if (_ws != null) + else if (_ws != null) return new CellRangeReference(_ws.Range(identifier), this); - - return identifier; + else + return identifier; } } diff --git a/ClosedXML/Excel/XLWorkbook.cs b/ClosedXML/Excel/XLWorkbook.cs index a33adcc..645d536 100644 --- a/ClosedXML/Excel/XLWorkbook.cs +++ b/ClosedXML/Excel/XLWorkbook.cs @@ -396,7 +396,7 @@ public Boolean TryGetWorksheet(String name, out IXLWorksheet worksheet) { - if (Worksheets.Any(w => w.Name.ToLower().Equals(name.ToLower()))) + if (Worksheets.Any(w => string.Equals(w.Name, XLWorksheets.TrimSheetName(name), StringComparison.OrdinalIgnoreCase))) { worksheet = Worksheet(name); return true; diff --git a/ClosedXML/Excel/XLWorksheets.cs b/ClosedXML/Excel/XLWorksheets.cs index ee17781..6207f57 100644 --- a/ClosedXML/Excel/XLWorksheets.cs +++ b/ClosedXML/Excel/XLWorksheets.cs @@ -56,17 +56,24 @@ return false; } - public IXLWorksheet Worksheet(String sheetName) + internal static string TrimSheetName(string sheetName) { - XLWorksheet w; if (sheetName.StartsWith("'") && sheetName.EndsWith("'") && sheetName.Length > 2) sheetName = sheetName.Substring(1, sheetName.Length - 2); + return sheetName; + } + + public IXLWorksheet Worksheet(String sheetName) + { + sheetName = TrimSheetName(sheetName); + + XLWorksheet w; + if (_worksheets.TryGetValue(sheetName, out w)) return w; - var wss = _worksheets.Where(ws => ws.Key.ToLower().Equals(sheetName.ToLower())); - + var wss = _worksheets.Where(ws => string.Equals(ws.Key, sheetName, StringComparison.OrdinalIgnoreCase)); if (wss.Any()) return wss.First().Value; diff --git a/ClosedXML/packages.config b/ClosedXML/packages.config index 682875d..cd2fc49 100644 --- a/ClosedXML/packages.config +++ b/ClosedXML/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/ClosedXML_Examples/ClosedXML_Examples.csproj b/ClosedXML_Examples/ClosedXML_Examples.csproj index 155d094..2daeac4 100644 --- a/ClosedXML_Examples/ClosedXML_Examples.csproj +++ b/ClosedXML_Examples/ClosedXML_Examples.csproj @@ -10,7 +10,7 @@ Properties ClosedXML_Examples ClosedXML_Examples - v4.0 + v4.5.2 512 @@ -24,6 +24,7 @@ full AnyCPU prompt + false bin\Release\ @@ -32,6 +33,7 @@ pdbonly AnyCPU prompt + false ClosedXML_Examples.Program @@ -43,7 +45,8 @@ ClosedXML.snk - + + ..\packages\DocumentFormat.OpenXml.2.7.1\lib\net45\DocumentFormat.OpenXml.dll True @@ -55,6 +58,7 @@ + diff --git a/ClosedXML_Examples/app.config b/ClosedXML_Examples/app.config index cb2586b..af399dd 100644 --- a/ClosedXML_Examples/app.config +++ b/ClosedXML_Examples/app.config @@ -1,3 +1,6 @@ - + + + + diff --git a/ClosedXML_Examples/packages.config b/ClosedXML_Examples/packages.config index 3a74e72..93a1c7a 100644 --- a/ClosedXML_Examples/packages.config +++ b/ClosedXML_Examples/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/ClosedXML_Net3.5/ClosedXML.snk b/ClosedXML_Net3.5/ClosedXML.snk deleted file mode 100644 index a17cff7..0000000 --- a/ClosedXML_Net3.5/ClosedXML.snk +++ /dev/null Binary files differ diff --git a/ClosedXML_Net3.5/ClosedXML_Net3.5.csproj b/ClosedXML_Net3.5/ClosedXML_Net3.5.csproj deleted file mode 100644 index f2acadf..0000000 --- a/ClosedXML_Net3.5/ClosedXML_Net3.5.csproj +++ /dev/null @@ -1,858 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {5F43B12B-A900-40C6-9924-A0C0B032F791} - Library - Properties - ClosedXML - ClosedXML - v3.5 - 512 - Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 1591 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\ClosedXML.xml - 1591 - - - true - - - ClosedXML.snk - - - - ..\packages\DocumentFormat.OpenXml.1.0\lib\DocumentFormat.OpenXml.dll - True - - - ..\packages\FastMember.Signed.1.1.0\lib\net35\FastMember.Signed.dll - True - - - - - - - - - - - - - AttributeExtensions.cs - - - Attributes\XLColumnAttribute.cs - - - Excel\AutoFilters\IXLAutoFilter.cs - - - Excel\AutoFilters\IXLBaseAutoFilter.cs - - - Excel\AutoFilters\IXLCustomFilteredColumn.cs - - - Excel\AutoFilters\IXLFilterColumn.cs - - - Excel\AutoFilters\IXLFilterConnector.cs - - - Excel\AutoFilters\IXLFilteredColumn.cs - - - Excel\AutoFilters\XLAutoFilter.cs - - - Excel\AutoFilters\XLCustomFilteredColumn.cs - - - Excel\AutoFilters\XLFilter.cs - - - Excel\AutoFilters\XLFilterColumn.cs - - - Excel\AutoFilters\XLFilterConnector.cs - - - Excel\AutoFilters\XLFilteredColumn.cs - - - Excel\CalcEngine\CalcEngine.cs - - - Excel\CalcEngine\CalcEngineHelpers.cs - - - Excel\CalcEngine\Expression.cs - - - Excel\CalcEngine\ExpressionCache.cs - - - Excel\CalcEngine\FunctionDefinition.cs - - - Excel\CalcEngine\Functions\Database.cs - - - Excel\CalcEngine\Functions\DateAndTime.cs - - - Excel\CalcEngine\Functions\Information.cs - - - Excel\CalcEngine\Functions\Logical.cs - - - Excel\CalcEngine\Functions\Lookup.cs - - - Excel\CalcEngine\Functions\MathTrig.cs - - - Excel\CalcEngine\Functions\Statistical.cs - - - Excel\CalcEngine\Functions\Tally.cs - - - Excel\CalcEngine\Functions\Text.cs - - - Excel\CalcEngine\Functions\XLMath.cs - - - Excel\CalcEngine\Functions\XLMatrix.cs - - - Excel\CalcEngine\Token.cs - - - Excel\CalcEngine\XLCalcEngine.cs - - - Excel\Cells\IXLCell.cs - - - Excel\Cells\IXLCells.cs - - - Excel\Cells\XLCell.cs - - - Excel\Cells\XLCells.cs - - - Excel\Cells\XLCellsCollection.cs - - - Excel\Charts\IXLChart.cs - - - Excel\Charts\IXLCharts.cs - - - Excel\Charts\XLChart.cs - - - Excel\Charts\XLCharts.cs - - - Excel\Columns\IXLColumn.cs - - - Excel\Columns\IXLColumns.cs - - - Excel\Columns\XLColumn.cs - - - Excel\Columns\XLColumnCollection.cs - - - Excel\Columns\XLColumnParameters.cs - - - Excel\Columns\XLColumns.cs - - - Excel\Comments\IXLComment.cs - - - Excel\Comments\XLComment.cs - - - Excel\ConditionalFormats\IXLCFColorScaleMax.cs - - - Excel\ConditionalFormats\IXLCFColorScaleMid.cs - - - Excel\ConditionalFormats\IXLCFColorScaleMin.cs - - - Excel\ConditionalFormats\IXLCFDataBarMax.cs - - - Excel\ConditionalFormats\IXLCFDataBarMin.cs - - - Excel\ConditionalFormats\IXLCFIconSet.cs - - - Excel\ConditionalFormats\IXLConditionalFormat.cs - - - Excel\ConditionalFormats\IXLConditionalFormats.cs - - - Excel\ConditionalFormats\Save\IXLCFConverter.cs - - - Excel\ConditionalFormats\Save\XLCFCellIsConverter.cs - - - Excel\ConditionalFormats\Save\XLCFColorScaleConverter.cs - - - Excel\ConditionalFormats\Save\XLCFContainsConverter.cs - - - Excel\ConditionalFormats\Save\XLCFConverters.cs - - - Excel\ConditionalFormats\Save\XLCFDataBarConverter.cs - - - Excel\ConditionalFormats\Save\XLCFEndsWithConverter.cs - - - Excel\ConditionalFormats\Save\XLCFIconSetConverter.cs - - - Excel\ConditionalFormats\Save\XLCFIsBlankConverter.cs - - - Excel\ConditionalFormats\Save\XLCFIsErrorConverter.cs - - - Excel\ConditionalFormats\Save\XLCFNotBlankConverter.cs - - - Excel\ConditionalFormats\Save\XLCFNotContainsConverter.cs - - - Excel\ConditionalFormats\Save\XLCFNotErrorConverter.cs - - - Excel\ConditionalFormats\Save\XLCFStartsWithConverter.cs - - - Excel\ConditionalFormats\Save\XLCFTopConverter.cs - - - Excel\ConditionalFormats\Save\XLCFUniqueConverter.cs - - - Excel\ConditionalFormats\XLCFColorScaleMax.cs - - - Excel\ConditionalFormats\XLCFColorScaleMid.cs - - - Excel\ConditionalFormats\XLCFColorScaleMin.cs - - - Excel\ConditionalFormats\XLCFDataBarMax.cs - - - Excel\ConditionalFormats\XLCFDataBarMin.cs - - - Excel\ConditionalFormats\XLCFIconSet.cs - - - Excel\ConditionalFormats\XLConditionalFormat.cs - - - Excel\ConditionalFormats\XLConditionalFormats.cs - - - Excel\Coordinate\IXLAddress.cs - - - Excel\Coordinate\XLAddress.cs - - - Excel\Coordinate\XLSheetPoint.cs - - - Excel\Coordinate\XLSheetRange.cs - - - Excel\CustomProperties\IXLCustomProperties.cs - - - Excel\CustomProperties\IXLCustomProperty.cs - - - Excel\CustomProperties\XLCustomProperties.cs - - - Excel\CustomProperties\XLCustomProperty.cs - - - Excel\DataValidation\IXLDataValidation.cs - - - Excel\DataValidation\IXLDataValidations.cs - - - Excel\DataValidation\IXLValidationCriteria.cs - - - Excel\DataValidation\XLDataValidation.cs - - - Excel\DataValidation\XLDataValidations.cs - - - Excel\DataValidation\XLDateCriteria.cs - - - Excel\DataValidation\XLDecimalCriteria.cs - - - Excel\DataValidation\XLTextLengthCriteria.cs - - - Excel\DataValidation\XLTimeCriteria.cs - - - Excel\DataValidation\XLValidationCriteria.cs - - - Excel\DataValidation\XLWholeNumberCriteria.cs - - - Excel\Drawings\IXLDrawing.cs - - - Excel\Drawings\IXLDrawingPosition.cs - - - Excel\Drawings\Style\IXLDrawingAlignment.cs - - - Excel\Drawings\Style\IXLDrawingColorsAndLines.cs - - - Excel\Drawings\Style\IXLDrawingFont.cs - - - Excel\Drawings\Style\IXLDrawingMargins.cs - - - Excel\Drawings\Style\IXLDrawingProperties.cs - - - Excel\Drawings\Style\IXLDrawingProtection.cs - - - Excel\Drawings\Style\IXLDrawingSize.cs - - - Excel\Drawings\Style\IXLDrawingStyle.cs - - - Excel\Drawings\Style\IXLDrawingWeb.cs - - - Excel\Drawings\Style\XLDrawingAlignment.cs - - - Excel\Drawings\Style\XLDrawingColorsAndLines.cs - - - Excel\Drawings\Style\XLDrawingFont.cs - - - Excel\Drawings\Style\XLDrawingMargins.cs - - - Excel\Drawings\Style\XLDrawingProperties.cs - - - Excel\Drawings\Style\XLDrawingProtection.cs - - - Excel\Drawings\Style\XLDrawingSize.cs - - - Excel\Drawings\Style\XLDrawingStyle.cs - - - Excel\Drawings\Style\XLDrawingWeb.cs - - - Excel\Drawings\XLDrawing.cs - - - Excel\Drawings\XLDrawingPosition.cs - - - Excel\EnumConverter.cs - - - Excel\Hyperlinks\IXLHyperlinks.cs - - - Excel\Hyperlinks\XLHyperlinks.cs - - - Excel\Hyperlinks\XLHyperlink_Internal.cs - - - Excel\Hyperlinks\XLHyperlink_public.cs - - - Excel\IXLOutline.cs - - - Excel\IXLSheetProtection.cs - - - Excel\IXLSheetView.cs - - - Excel\IXLTheme.cs - - - Excel\IXLWorksheet.cs - - - Excel\IXLWorksheets.cs - - - Excel\Misc\XLCallbackAction.cs - - - Excel\Misc\XLDictionary.cs - - - Excel\Misc\XLFormula.cs - - - Excel\Misc\XLIdManager.cs - - - Excel\Misc\XLReentrantEnumerableSet.cs - - - Excel\NamedRanges\IXLNamedRange.cs - - - Excel\NamedRanges\IXLNamedRanges.cs - - - Excel\NamedRanges\XLNamedRange.cs - - - Excel\NamedRanges\XLNamedRanges.cs - - - Excel\PageSetup\IXLHeaderFooter.cs - - - Excel\PageSetup\IXLHFItem.cs - - - Excel\PageSetup\IXLMargins.cs - - - Excel\PageSetup\IXLPageSetup.cs - - - Excel\PageSetup\IXLPrintAreas.cs - - - Excel\PageSetup\XLHeaderFooter.cs - - - Excel\PageSetup\XLHFItem.cs - - - Excel\PageSetup\XLHFText.cs - - - Excel\PageSetup\XLMargins.cs - - - Excel\PageSetup\XLPageSetup.cs - - - Excel\PageSetup\XLPrintAreas.cs - - - Excel\PivotTables\IXLPivotField.cs - - - Excel\PivotTables\IXLPivotFields.cs - - - Excel\PivotTables\IXLPivotTable.cs - - - Excel\PivotTables\IXLPivotTables.cs - - - Excel\PivotTables\PivotValues\IXLPivotValue.cs - - - Excel\PivotTables\PivotValues\IXLPivotValueCombination.cs - - - Excel\PivotTables\PivotValues\IXLPivotValueFormat.cs - - - Excel\PivotTables\PivotValues\IXLPivotValues.cs - - - Excel\PivotTables\PivotValues\XLPivotValue.cs - - - Excel\PivotTables\PivotValues\XLPivotValueCombination.cs - - - Excel\PivotTables\PivotValues\XLPivotValueFormat.cs - - - Excel\PivotTables\PivotValues\XLPivotValues.cs - - - Excel\PivotTables\XLPivotField.cs - - - Excel\PivotTables\XLPivotFields.cs - - - Excel\PivotTables\XLPivotTable.cs - - - Excel\PivotTables\XLPivotTables.cs - - - Excel\Ranges\IXLRange.cs - - - Excel\Ranges\IXLRangeAddress.cs - - - Excel\Ranges\IXLRangeBase.cs - - - Excel\Ranges\IXLRangeColumn.cs - - - Excel\Ranges\IXLRangeColumns.cs - - - Excel\Ranges\IXLRangeRow.cs - - - Excel\Ranges\IXLRangeRows.cs - - - Excel\Ranges\IXLRanges.cs - - - Excel\Ranges\Sort\IXLSortElement.cs - - - Excel\Ranges\Sort\IXLSortElements.cs - - - Excel\Ranges\Sort\XLSortElement.cs - - - Excel\Ranges\Sort\XLSortElements.cs - - - Excel\Ranges\XLRange.cs - - - Excel\Ranges\XLRangeAddress.cs - - - Excel\Ranges\XLRangeBase.cs - - - Excel\Ranges\XLRangeColumn.cs - - - Excel\Ranges\XLRangeColumns.cs - - - Excel\Ranges\XLRangeParameters.cs - - - Excel\Ranges\XLRangeRow.cs - - - Excel\Ranges\XLRangeRows.cs - - - Excel\Ranges\XLRanges.cs - - - Excel\RichText\IXLFormattedText.cs - - - Excel\RichText\IXLPhonetic.cs - - - Excel\RichText\IXLPhonetics.cs - - - Excel\RichText\IXLRichString.cs - - - Excel\RichText\IXLRichText.cs - - - Excel\RichText\XLFormattedText.cs - - - Excel\RichText\XLPhonetic.cs - - - Excel\RichText\XLPhonetics.cs - - - Excel\RichText\XLRichString.cs - - - Excel\RichText\XLRichText.cs - - - Excel\Rows\IXLRow.cs - - - Excel\Rows\IXLRows.cs - - - Excel\Rows\XLRow.cs - - - Excel\Rows\XLRowCollection.cs - - - Excel\Rows\XLRowParameters.cs - - - Excel\Rows\XLRows.cs - - - Excel\Style\Colors\XLColor_Internal.cs - - - Excel\Style\Colors\XLColor_Public.cs - - - Excel\Style\Colors\XLColor_Static.cs - - - Excel\Style\IXLAlignment.cs - - - Excel\Style\IXLBorder.cs - - - Excel\Style\IXLFill.cs - - - Excel\Style\IXLFont.cs - - - Excel\Style\IXLFontBase.cs - - - Excel\Style\IXLNumberFormat.cs - - - Excel\Style\IXLNumberFormatBase.cs - - - Excel\Style\IXLProtection.cs - - - Excel\Style\IXLStyle.cs - - - Excel\Style\IXLStylized.cs - - - Excel\Style\XLAlignment.cs - - - Excel\Style\XLBorder.cs - - - Excel\Style\XLFill.cs - - - Excel\Style\XLFont.cs - - - Excel\Style\XLNumberFormat.cs - - - Excel\Style\XLProtection.cs - - - Excel\Style\XLStyle.cs - - - Excel\Style\XLStylizedContainer.cs - - - Excel\Tables\IXLTable.cs - - - Excel\Tables\IXLTableField.cs - - - Excel\Tables\IXLTableRange.cs - - - Excel\Tables\IXLTableRow.cs - - - Excel\Tables\IXLTableRows.cs - - - Excel\Tables\IXLTables.cs - - - Excel\Tables\XLTable.cs - - - Excel\Tables\XLTableField.cs - - - Excel\Tables\XLTableRange.cs - - - Excel\Tables\XLTableRow.cs - - - Excel\Tables\XLTableRows.cs - - - Excel\Tables\XLTables.cs - - - Excel\Tables\XLTableTheme.cs - - - Excel\XLConstants.cs - - - Excel\XLOutline.cs - - - Excel\XLSheetProtection.cs - - - Excel\XLSheetView.cs - - - Excel\XLTheme.cs - - - Excel\XLWorkbook.cs - - - Excel\XLWorkbookProperties.cs - - - Excel\XLWorkbook_Load.cs - - - Excel\XLWorkbook_Save.cs - - - Excel\XLWorkbook_Save.NestedTypes.cs - - - Excel\XLWorksheet.cs - - - Excel\XLWorksheetInternals.cs - - - Excel\XLWorksheets.cs - - - Excel\XLWSContentManager.cs - - - Extensions.cs - - - PathHelper.cs - - - Utils\GraphicsUtils.cs - - - Utils\XmlEncoder.cs - - - XLHelper.cs - - - - - - - .editorconfig - - - - - - - - \ No newline at end of file diff --git a/ClosedXML_Net3.5/Excel/CalcEngine/Functions/Information.cs b/ClosedXML_Net3.5/Excel/CalcEngine/Functions/Information.cs deleted file mode 100644 index dcb1340..0000000 --- a/ClosedXML_Net3.5/Excel/CalcEngine/Functions/Information.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing.Design; - -namespace ClosedXML.Excel.CalcEngine.Functions -{ - internal static class Information - { - public static void Register(CalcEngine ce) - { - ce.RegisterFunction("ERRORTYPE",1,ErrorType); - ce.RegisterFunction("ISBLANK", 1,int.MaxValue, IsBlank); - ce.RegisterFunction("ISERR",1, int.MaxValue, IsErr); - ce.RegisterFunction("ISERROR",1, int.MaxValue, IsError); - ce.RegisterFunction("ISEVEN",1, IsEven); - ce.RegisterFunction("ISLOGICAL",1,int.MaxValue,IsLogical); - ce.RegisterFunction("ISNA",1, int.MaxValue, IsNa); - ce.RegisterFunction("ISNONTEXT",1, int.MaxValue, IsNonText); - ce.RegisterFunction("ISNUMBER",1, int.MaxValue, IsNumber); - ce.RegisterFunction("ISODD",1,IsOdd); - ce.RegisterFunction("ISREF",1, int.MaxValue, IsRef); - ce.RegisterFunction("ISTEXT",1, int.MaxValue, IsText); - ce.RegisterFunction("N",1,N); - ce.RegisterFunction("NA",0,NA); - ce.RegisterFunction("TYPE",1,Type); - } - - static object ErrorType(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - - static object IsBlank(List p) - { - var v = (string) p[0].Evaluate(); - var isBlank = string.IsNullOrEmpty(v); - p.RemoveAt(0); - - if (isBlank && p.Count > 0) { - isBlank = (bool)IsBlank(p); - } - - return isBlank; - } - - //TODO: Support for Error Values - static object IsErr(List p) - { - //TODO: Write Code - throw new NotSupportedException(); - } - - static object IsError(List p) - { - //TODO: Write Code - throw new NotSupportedException(); - } - - static object IsEven(List p) - { - var v = p[0].Evaluate(); - if (v is double) - { - return Math.Abs((double) v%2) < 0; - } - throw new ArgumentException("Expression doesn't evaluate to double"); - } - - static object IsLogical(List p) - { - var v = p[0].Evaluate(); - var isLogical = v is bool; - p.RemoveAt(0); - - if (isLogical && p.Count > 0) - { - isLogical = (bool) IsLogical(p); - } - - return isLogical; - } - - static object IsNa(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - - static object IsNonText(List p) - { - return !(bool) IsText(p); - } - - static object IsNumber(List p) - { - var v = p[0].Evaluate(); - var isNumber = v is double; - p.RemoveAt(0); - - if (isNumber && p.Count > 0) { - isNumber = (bool)IsNumber(p); - } - - return isNumber; - } - - static object IsOdd(List p) - { - return !(bool) IsEven(p); - } - - static object IsRef(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - - static object IsText(List p) - { - //Evaluate Expressions - var isText = !(bool) IsBlank(p); - if (isText) - { - isText = !(bool) IsNumber(p); - } - if (isText) - { - isText = !(bool) IsLogical(p); - } - return isText; - } - - static object N(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - - static object NA(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - - static object Type(List p) - { - //TODO: Write Code - throw new NotSupportedException();; - } - } -} \ No newline at end of file diff --git a/ClosedXML_Net3.5/Excel/Style/XLStylizedEmpty.cs b/ClosedXML_Net3.5/Excel/Style/XLStylizedEmpty.cs deleted file mode 100644 index 9e059f9..0000000 --- a/ClosedXML_Net3.5/Excel/Style/XLStylizedEmpty.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - internal class XLStylizedEmpty: IXLStylized - { - public XLStylizedEmpty(IXLStyle defaultStyle) - { - Style = defaultStyle; - } - public IXLStyle Style { get; set; } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - yield return Style; - UpdatingStyle = false; - } - } - - public bool UpdatingStyle { get; set; } - - public IXLStyle InnerStyle { get; set; } - - public IXLRanges RangesUsed - { - get { return new XLRanges(); } - } - - public bool StyleChanged { get; set; } - } -} diff --git a/ClosedXML_Net3.5/Properties/AssemblyInfo.cs b/ClosedXML_Net3.5/Properties/AssemblyInfo.cs deleted file mode 100644 index f650ca3..0000000 --- a/ClosedXML_Net3.5/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ClosedXML_Net3.5")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ClosedXML_Net3.5")] -[assembly: AssemblyCopyright("Copyright © Manuel De Leon 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d627551d-470d-4a39-a5f1-5a71696b8200")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.80.0.0")] -[assembly: AssemblyFileVersion("0.80.0.0")] diff --git a/ClosedXML_Net3.5/packages.config b/ClosedXML_Net3.5/packages.config deleted file mode 100644 index 6908883..0000000 --- a/ClosedXML_Net3.5/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj b/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj index 2b2d041..5c7b02a 100644 --- a/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj +++ b/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj @@ -10,9 +10,7 @@ Properties ClosedXML_Sandbox ClosedXML_Sandbox - v4.5.1 - - + v4.5.2 512 ..\ true @@ -36,8 +34,8 @@ false - - ..\packages\DocumentFormat.OpenXml.2.5\lib\DocumentFormat.OpenXml.dll + + ..\packages\DocumentFormat.OpenXml.2.7.1\lib\net45\DocumentFormat.OpenXml.dll True diff --git a/ClosedXML_Sandbox/app.config b/ClosedXML_Sandbox/app.config index 22c902a..af399dd 100644 --- a/ClosedXML_Sandbox/app.config +++ b/ClosedXML_Sandbox/app.config @@ -1,3 +1,6 @@ - + + + + diff --git a/ClosedXML_Sandbox/packages.config b/ClosedXML_Sandbox/packages.config index 3a74e72..93a1c7a 100644 --- a/ClosedXML_Sandbox/packages.config +++ b/ClosedXML_Sandbox/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/ClosedXML_Tests/ClosedXML_Tests.csproj b/ClosedXML_Tests/ClosedXML_Tests.csproj index 9eac192..1ad18c5 100644 --- a/ClosedXML_Tests/ClosedXML_Tests.csproj +++ b/ClosedXML_Tests/ClosedXML_Tests.csproj @@ -11,7 +11,7 @@ Properties ClosedXML_Tests ClosedXML_Tests - v4.0 + v4.5.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} ..\ @@ -22,17 +22,19 @@ full false bin\Debug\ - DEBUG;TRACE + DEBUG;TRACE;$(AppVeyor) prompt 4 + false pdbonly true bin\Release\ - TRACE + TRACE;$(AppVeyor) prompt 4 + false true @@ -41,13 +43,13 @@ ClosedXML.snk - - ..\packages\DocumentFormat.OpenXml.2.5\lib\DocumentFormat.OpenXml.dll + + ..\packages\DocumentFormat.OpenXml.2.7.1\lib\net45\DocumentFormat.OpenXml.dll True - ..\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll + ..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll True diff --git a/ClosedXML_Tests/Excel/Misc/FormulaTests.cs b/ClosedXML_Tests/Excel/Misc/FormulaTests.cs index a1e1a66..9cfaf7e 100644 --- a/ClosedXML_Tests/Excel/Misc/FormulaTests.cs +++ b/ClosedXML_Tests/Excel/Misc/FormulaTests.cs @@ -1,6 +1,7 @@ using ClosedXML.Excel; using NUnit.Framework; using System; +using System.Linq; namespace ClosedXML_Tests.Excel { @@ -63,6 +64,47 @@ } [Test] + public void FormulaWithReferenceIncludingSheetName() + { + using (var wb = new XLWorkbook()) + { + object value; + var ws = wb.AddWorksheet("Sheet1"); + ws.Cell("A1").InsertData(Enumerable.Range(1, 50)); + ws.Cell("B1").FormulaA1 = "=SUM(A1:A50)"; + value = ws.Cell("B1").Value; + Assert.AreEqual(1275, value); + + ws = wb.AddWorksheet("Sheet2"); + + ws.Cell("A1").FormulaA1 = "=SUM(Sheet1!A1:Sheet1!A50)"; + value = ws.Cell("A1").Value; + Assert.AreEqual(1275, value); + + ws.Cell("B1").FormulaA1 = "=SUM(Sheet1!A1:A50)"; + value = ws.Cell("B1").Value; + Assert.AreEqual(1275, value); + } + } + + [Test] + public void InvalidReferences() + { + using (var wb = new XLWorkbook()) + { + var ws = wb.AddWorksheet("Sheet1"); + ws.Cell("A1").InsertData(Enumerable.Range(1, 50)); + ws = wb.AddWorksheet("Sheet2"); + + ws.Cell("A1").FormulaA1 = "=SUM(Sheet1!A1:Sheet2!A50)"; + Assert.That(() => ws.Cell("A1").Value, Throws.InstanceOf()); + + ws.Cell("B1").FormulaA1 = "=SUM(Sheet1!A1:UnknownSheet!A50)"; + Assert.That(() => ws.Cell("B1").Value, Throws.InstanceOf()); + } + } + + [Test] public void DateAgainstStringComparison() { using (var wb = new XLWorkbook()) diff --git a/ClosedXML_Tests/packages.config b/ClosedXML_Tests/packages.config index dcf0b39..df4f149 100644 --- a/ClosedXML_Tests/packages.config +++ b/ClosedXML_Tests/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index ec1e5b7..b850a36 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,9 @@ except: - gh-pages # Build worker image (VM template) -image: Visual Studio 2017 +image: Visual Studio 2015 +environment: + AppVeyor: APPVEYOR # enable patching of AssemblyInfo.* files assembly_info: @@ -17,7 +19,7 @@ assembly_version: "{version}" assembly_file_version: "{version}" assembly_informational_version: "{version}" - + #---------------------------------# # build configuration # #---------------------------------# @@ -26,16 +28,16 @@ platform: Any CPU build: - parallel: true # enable MSBuild parallel builds + parallel: true # enable MSBuild parallel builds project: ClosedXML.sln # path to Visual Studio solution or project verbosity: minimal - + configuration : Release #Restore before_build: - nuget restore - + artifacts: -- path: ClosedXML/bin/Release/ClosedXML.dll -- path: ClosedXML/bin/Release/ClosedXML.xml + - path: ClosedXML/bin/Release/ClosedXML.dll + - path: ClosedXML/bin/Release/ClosedXML.xml