diff --git a/ClosedXML/ClosedXML.sln b/ClosedXML/ClosedXML.sln deleted file mode 100644 index 0c32eca..0000000 --- a/ClosedXML/ClosedXML.sln +++ /dev/null @@ -1,94 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML", "ClosedXML\ClosedXML.csproj", "{BD5E6BFE-E837-4A35-BCA9-39667D873A20}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Sandbox", "ClosedXML_Sandbox\ClosedXML_Sandbox.csproj", "{38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Test", "ClosedXML_Test\ClosedXML_Test.csproj", "{D41B4F43-AB44-4236-B959-D508D259F4A7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C94E22C-85AA-48FD-B082-CF929FFC6C31}" - ProjectSection(SolutionItems) = preProject - ClosedXML.vsmdi = ClosedXML.vsmdi - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Examples", "ClosedXML_Examples\ClosedXML_Examples.csproj", "{03A518D0-1CB7-488E-861C-C4E782B27A46}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 5 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = https://tfs09.codeplex.com/ - SccLocalPath0 = . - SccProjectUniqueName1 = ClosedXML\\ClosedXML.csproj - SccProjectName1 = ClosedXML - SccLocalPath1 = ClosedXML - SccProjectUniqueName2 = ClosedXML_Sandbox\\ClosedXML_Sandbox.csproj - SccProjectName2 = ClosedXML_Sandbox - SccLocalPath2 = ClosedXML_Sandbox - SccProjectUniqueName3 = ClosedXML_Test\\ClosedXML_Test.csproj - SccProjectName3 = ClosedXML_Test - SccLocalPath3 = ClosedXML_Test - SccProjectUniqueName4 = ClosedXML_Examples\\ClosedXML_Examples.csproj - SccProjectName4 = ClosedXML_Examples - SccLocalPath4 = ClosedXML_Examples - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = ClosedXML.vsmdi - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|x86.ActiveCfg = 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 - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|x86.ActiveCfg = Release|Any CPU - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|x86.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|x86.Build.0 = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Mixed Platforms.Build.0 = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|x86.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|x86.Build.0 = Release|x86 - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Debug|x86.ActiveCfg = Debug|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Release|Any CPU.Build.0 = Release|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {D41B4F43-AB44-4236-B959-D508D259F4A7}.Release|x86.ActiveCfg = Release|Any CPU - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|x86.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|x86.Build.0 = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Mixed Platforms.Build.0 = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|x86.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/ClosedXML/ClosedXML.vsmdi b/ClosedXML/ClosedXML.vsmdi deleted file mode 100644 index 2acf62a..0000000 --- a/ClosedXML/ClosedXML.vsmdi +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML.vssscc b/ClosedXML/ClosedXML.vssscc deleted file mode 100644 index 794f014..0000000 --- a/ClosedXML/ClosedXML.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/ClosedXML/ClosedXML/ClosedXML.csproj b/ClosedXML/ClosedXML/ClosedXML.csproj deleted file mode 100644 index ba4c496..0000000 --- a/ClosedXML/ClosedXML/ClosedXML.csproj +++ /dev/null @@ -1,72 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - Library - Properties - ClosedXML - ClosedXML - v4.0 - 512 - SAK - SAK - SAK - SAK - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc b/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML/ClosedXML.sln b/ClosedXML/ClosedXML/ClosedXML.sln deleted file mode 100644 index 086fadf..0000000 --- a/ClosedXML/ClosedXML/ClosedXML.sln +++ /dev/null @@ -1,79 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML", "ClosedXML\ClosedXML.csproj", "{BD5E6BFE-E837-4A35-BCA9-39667D873A20}" -EndProject -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 - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClosedXML_Examples", "ClosedXML_Examples\ClosedXML_Examples.csproj", "{03A518D0-1CB7-488E-861C-C4E782B27A46}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 4 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs09 - SccLocalPath0 = . - SccProjectUniqueName1 = ClosedXML\\ClosedXML.csproj - SccProjectName1 = ClosedXML - SccLocalPath1 = ClosedXML - SccProjectUniqueName2 = ClosedXML_Examples\\ClosedXML_Examples.csproj - SccProjectName2 = ClosedXML_Examples - SccLocalPath2 = ClosedXML_Examples - SccProjectUniqueName3 = ClosedXML_Sandbox\\ClosedXML_Sandbox.csproj - SccProjectName3 = ClosedXML_Sandbox - SccLocalPath3 = ClosedXML_Sandbox - EndGlobalSection - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = ClosedXML.vsmdi - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {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}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Debug|x86.ActiveCfg = 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 - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {BD5E6BFE-E837-4A35-BCA9-39667D873A20}.Release|x86.ActiveCfg = Release|Any CPU - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Any CPU.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|x86.ActiveCfg = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Debug|x86.Build.0 = Debug|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Any CPU.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|Mixed Platforms.Build.0 = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|x86.ActiveCfg = Release|x86 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB}.Release|x86.Build.0 = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Any CPU.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|x86.ActiveCfg = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Debug|x86.Build.0 = Debug|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Any CPU.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|Mixed Platforms.Build.0 = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|x86.ActiveCfg = Release|x86 - {03A518D0-1CB7-488E-861C-C4E782B27A46}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/ClosedXML/ClosedXML/ClosedXML.vsmdi b/ClosedXML/ClosedXML/ClosedXML.vsmdi deleted file mode 100644 index 2acf62a..0000000 --- a/ClosedXML/ClosedXML/ClosedXML.vsmdi +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML.vssscc b/ClosedXML/ClosedXML/ClosedXML.vssscc deleted file mode 100644 index 794f014..0000000 --- a/ClosedXML/ClosedXML/ClosedXML.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj b/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj deleted file mode 100644 index a5e8c9b..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - Library - Properties - ClosedXML - ClosedXML - v4.0 - 512 - SAK - SAK - SAK - SAK - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - False - ..\..\..\My Documents\Code\OX.Copyable\havard-copyable-fd863c3\OX.Copyable\bin\Release\OX.Copyable.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc b/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/ClosedXML.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLAddress.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLAddress.cs deleted file mode 100644 index e232ae8..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLAddress.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - public interface IXLAddress : IEqualityComparer, IEquatable, IComparable, IComparable - { - Int32 Row { get; } - Int32 Column { get; } - String ColumnLetter { get; } - } - - public static class XLAddressMethods - { - - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs deleted file mode 100644 index 7561b9f..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLCell.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public enum XLCellValues { SharedString, Number, Boolean, DateTime } - - public interface IXLCell: IXLStylized - { - Boolean Initialized { get; } - String Value { get; set; } - IXLAddress Address { get; } - XLCellValues DataType { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLColumn.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLColumn.cs deleted file mode 100644 index cde3796..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLColumn.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - public interface IXLColumn: IXLRange - { - Int32 Width { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLRange.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLRange.cs deleted file mode 100644 index 671fe45..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLRange.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public interface IXLRange: IXLStylized - { - Dictionary CellsCollection { get; } - - IXLAddress FirstCellAddress { get; } - IXLAddress LastCellAddress { get; } - IXLRange Row(Int32 row); - IXLRange Column(Int32 column); - IXLRange Column(String column); - } - - public static class XLRangeMethods - { - public static IXLCell FirstCell(this IXLRange range) - { - return range.Cell(1, 1); - } - public static IXLCell LastCell(this IXLRange range) - { - return range.Cell(range.RowCount(), range.ColumnCount()); - } - - public static IXLCell Cell(this IXLRange range, IXLAddress cellAddressInRange) - { - IXLAddress absoluteAddress = (XLAddress)cellAddressInRange + (XLAddress)range.FirstCellAddress - 1; - if (range.CellsCollection.ContainsKey(absoluteAddress)) - { - return range.CellsCollection[absoluteAddress]; - } - else - { - var newCell = new XLCell(absoluteAddress, range.Style); - range.CellsCollection.Add(absoluteAddress, newCell); - return newCell; - } - } - public static IXLCell Cell(this IXLRange range, Int32 row, Int32 column) - { - return range.Cell(new XLAddress(row, column)); - } - public static IXLCell Cell(this IXLRange range, Int32 row, String column) - { - return range.Cell(new XLAddress(row, column)); - } - public static IXLCell Cell(this IXLRange range, String cellAddressInRange) - { - return range.Cell(new XLAddress(cellAddressInRange)); - } - - public static Int32 RowCount(this IXLRange range) - { - return range.LastCellAddress.Row - range.FirstCellAddress.Row + 1; - } - public static Int32 ColumnCount(this IXLRange range) - { - return range.LastCellAddress.Column - range.FirstCellAddress.Column + 1; - } - - public static IXLRange Range(this IXLRange range, String rangeAddress) - { - String[] arrRange = rangeAddress.Split(':'); - return range.Range(arrRange[0], arrRange[1]); - } - public static IXLRange Range(this IXLRange range, String firstCellAddress, String lastCellAddress) - { - return range.Range(new XLAddress(firstCellAddress), new XLAddress(lastCellAddress)); - } - public static IXLRange Range(this IXLRange range, IXLAddress firstCellAddress, IXLAddress lastCellAddress) - { - return new XLRange( - (XLAddress)firstCellAddress + (XLAddress)range.FirstCellAddress - 1, - (XLAddress)lastCellAddress + (XLAddress)range.FirstCellAddress - 1, - range.CellsCollection - ); - } - public static IXLRange Range(this IXLRange range, IXLCell firstCell, IXLCell lastCell) - { - return range.Range(firstCell.Address, lastCell.Address); - } - - - public static IEnumerable Cells(this IXLRange range) - { - foreach(var row in Enumerable.Range(1, range.RowCount())) - { - foreach(var column in Enumerable.Range(1, range.ColumnCount())) - { - yield return range.Cell(row, column); - } - } - } - - - } -} - diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorkbook.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorkbook.cs deleted file mode 100644 index e4b3074..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorkbook.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public interface IXLWorkbook - { - IXLWorksheets Worksheets { get; } - String Name { get; } - String FullName { get; } - void SaveAs(String file, Boolean overwrite = false); - //IXLStyle DefaultStyle { get; set; } - - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheet.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheet.cs deleted file mode 100644 index 8b4274a..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheet.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - public interface IXLWorksheet: IXLRange - { - new IXLColumn Column(Int32 column); - new IXLColumn Column(String column); - - String Name { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheets.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheets.cs deleted file mode 100644 index e3826b9..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/IXLWorksheets.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - public interface IXLWorksheets: IEnumerable - { - IXLWorksheet GetWorksheet(String sheetName); - IXLWorksheet GetWorksheet(Int32 sheetIndex); - IXLWorksheet Add(String sheetName); - void Delete(String sheetName); - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLAlignment.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLAlignment.cs deleted file mode 100644 index f1d4715..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLAlignment.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public enum XLAlignmentReadingOrderValues - { - ContextDependent, - LeftToRight, - RightToLeft - } - - public enum XLAlignmentHorizontalValues - { - Center, - CenterContinuous, - Distributed, - Fill, - General, - Justify, - Left, - Right - } - - public enum XLAlignmentVerticalValues - { - Bottom, - Center, - Distributed, - Justify, - Top - } - - public interface IXLAlignment - { - XLAlignmentHorizontalValues Horizontal { get; set; } - - XLAlignmentVerticalValues Vertical { get; set; } - - UInt32 Indent { get; set; } - - Boolean JustifyLastLine { get; set; } - - XLAlignmentReadingOrderValues ReadingOrder { get; set; } - - Int32 RelativeIndent { get; set; } - - Boolean ShrinkToFit { get; set; } - - UInt32 TextRotation { get; set; } - - Boolean WrapText { get; set; } - - Boolean TopToBottom { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLBorder.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLBorder.cs deleted file mode 100644 index fa8cb42..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLBorder.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML.Excel.Style -{ - public enum XLBorderStyleValues - { - DashDot, - DashDotDot, - Dashed, - Dotted, - Double, - Hair, - Medium, - MediumDashDot, - MediumDashDotDot, - MediumDashed, - None, - SlantDashDot, - Thick, - Thin - } - public interface IXLBorder - { - XLBorderStyleValues LeftBorder { get; set; } - - Color LeftBorderColor { get; set; } - - XLBorderStyleValues RightBorder { get; set; } - - Color RightBorderColor { get; set; } - - XLBorderStyleValues TopBorder { get; set; } - - Color TopBorderColor { get; set; } - - XLBorderStyleValues BottomBorder { get; set; } - - Color BottomBorderColor { get; set; } - - Boolean DiagonalUp { get; set; } - - Boolean DiagonalDown { get; set; } - - XLBorderStyleValues DiagonalBorder { get; set; } - - Color DiagonalBorderColor { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFill.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFill.cs deleted file mode 100644 index 2e50c03..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFill.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML.Excel.Style -{ - public enum XLFillPatternValues - { - DarkDown, - DarkGray, - DarkGrid, - DarkHorizontal, - DarkTrellis, - DarkUp, - DarkVertical, - Gray0625, - Gray125, - LightDown, - LightGray, - LightGrid, - LightHorizontal, - LightTrellis, - LightUp, - LightVertical, - MediumGray, - None, - Solid - } - - public interface IXLFill - { - Color BackgroundColor { get; set; } - - Color PatternColor { get; set; } - - Color PatternBackgroundColor { get; set; } - - XLFillPatternValues PatternType { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFont.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFont.cs deleted file mode 100644 index 8cd2e0c..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLFont.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML.Excel.Style -{ - public enum XLFontUnderlineValues - { - Double, - DoubleAccounting, - None, - Single, - SingleAccounting - } - - public enum XLFontVerticalTextAlignmentValues - { - Baseline, - Subscript, - Superscript - } - - public enum XLFontFamilyNumberingValues - { - NotApplicable = 0, - Roman = 1, - Swiss = 2, - Modern = 3, - Script = 4, - Decorative = 5 - } - - public interface IXLFont - { - Boolean Bold { get; set; } - Boolean Italic { get; set; } - XLFontUnderlineValues Underline { get; set; } - Boolean Strikethrough { get; set; } - XLFontVerticalTextAlignmentValues VerticalAlignment { get; set; } - Boolean Shadow { get; set; } - Double FontSize { get; set; } - Color FontColor { get; set; } - String FontName { get; set; } - XLFontFamilyNumberingValues FontFamilyNumbering { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLNumberFormat.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLNumberFormat.cs deleted file mode 100644 index 7e86c68..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLNumberFormat.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public interface IXLNumberFormat - { - UInt32? NumberFormatId { get; set; } - String Format { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStyle.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStyle.cs deleted file mode 100644 index 4a45c11..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStyle.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public interface IXLStyle - { - IXLAlignment Alignment { get; set; } - IXLBorder Border { get; set; } - IXLFill Fill { get; set; } - IXLFont Font { get; set; } - IXLNumberFormat NumberFormat { get; set; } - - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStylized.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStylized.cs deleted file mode 100644 index c729e4c..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/IXLStylized.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public interface IXLStylized - { - IXLStyle Style { get; set; } - IEnumerable Styles { get; } - Boolean UpdatingStyle { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs deleted file mode 100644 index 20dd845..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public class XLAlignment: IXLAlignment - { - public XLAlignmentHorizontalValues Horizontal { get; set; } - - public XLAlignmentVerticalValues Vertical { get; set; } - - public uint Indent { get; set; } - - public bool JustifyLastLine { get; set; } - - public XLAlignmentReadingOrderValues ReadingOrder { get; set; } - - public int RelativeIndent { get; set; } - - public bool ShrinkToFit { get; set; } - - public uint TextRotation { get; set; } - - public bool WrapText { get; set; } - - public bool TopToBottom { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs deleted file mode 100644 index 7345d99..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -namespace ClosedXML.Excel.Style -{ - public class XLBorder: IXLBorder - { - public XLBorderStyleValues LeftBorder { get; set; } - - public Color LeftBorderColor { get; set; } - - public XLBorderStyleValues RightBorder { get; set; } - - public Color RightBorderColor { get; set; } - - public XLBorderStyleValues TopBorder { get; set; } - - public Color TopBorderColor { get; set; } - - public XLBorderStyleValues BottomBorder { get; set; } - - public Color BottomBorderColor { get; set; } - - public bool DiagonalUp { get; set; } - - public bool DiagonalDown { get; set; } - - public XLBorderStyleValues DiagonalBorder { get; set; } - - public Color DiagonalBorderColor { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFill.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFill.cs deleted file mode 100644 index 8d40bb9..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFill.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML.Excel.Style -{ - public class XLFill: IXLFill - { - #region Properties - - public Color BackgroundColor - { - get - { - return patternColor; - } - set - { - if (container != null && !container.UpdatingStyle) - { - container.Styles.ForEach(s => s.Fill.BackgroundColor = value); - } - else - { - patternType = XLFillPatternValues.Solid; - patternColor = value; - patternBackgroundColor = value; - } - } - } - - private Color patternColor; - public Color PatternColor - { - get - { - return patternColor; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Fill.PatternColor = value); - else - patternColor = value; - } - } - - private Color patternBackgroundColor; - public Color PatternBackgroundColor - { - get - { - return patternBackgroundColor; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Fill.PatternBackgroundColor = value); - else - patternBackgroundColor = value; - } - } - - private XLFillPatternValues patternType; - public XLFillPatternValues PatternType - { - get - { - return patternType; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Fill.PatternType = value); - else - patternType = value; - } - } - - #endregion - - #region Constructors - - IXLStylized container; - public XLFill(IXLStylized container, IXLFill defaultFill = null) - { - this.container = container; - if (defaultFill != null) - { - PatternType = defaultFill.PatternType; - PatternColor = defaultFill.PatternColor; - PatternBackgroundColor = defaultFill.PatternBackgroundColor; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - return BackgroundColor.ToString() + "-" + PatternType.ToString() + "-" + PatternColor.ToString(); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFont.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFont.cs deleted file mode 100644 index d300433..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLFont.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML.Excel.Style -{ - public class XLFont: IXLFont - { - IXLStylized container; - public XLFont(IXLStylized container, IXLFont defaultFont = null) - { - this.container = container; - if (defaultFont != null) - { - Bold = defaultFont.Bold; - Italic = defaultFont.Italic; - Underline = defaultFont.Underline; - Strikethrough = defaultFont.Strikethrough; - VerticalAlignment = defaultFont.VerticalAlignment; - Shadow = defaultFont.Shadow; - FontSize = defaultFont.FontSize; - FontColor = defaultFont.FontColor; - FontName = defaultFont.FontName; - FontFamilyNumbering = defaultFont.FontFamilyNumbering; - } - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append(Bold.ToString()); - sb.Append("-"); - sb.Append(Italic.ToString()); - sb.Append("-"); - sb.Append(Underline.ToString()); - sb.Append("-"); - sb.Append(Strikethrough.ToString()); - sb.Append("-"); - sb.Append(VerticalAlignment.ToString()); - sb.Append("-"); - sb.Append(Shadow.ToString()); - sb.Append("-"); - sb.Append(FontSize.ToString()); - sb.Append("-"); - sb.Append(FontColor.ToHex()); - sb.Append("-"); - sb.Append(FontName); - sb.Append("-"); - sb.Append(FontFamilyNumbering.ToString()); - return sb.ToString(); - } - - #region IXLFont Members - - private Boolean bold; - public Boolean Bold - { - get - { - return bold; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.Bold = value); - else - bold = value; - } - } - - private Boolean italic; - public Boolean Italic - { - get - { - return italic; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.Italic = value); - else - italic = value; - } - } - - private XLFontUnderlineValues underline; - public XLFontUnderlineValues Underline - { - get - { - return underline; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.Underline = value); - else - underline = value; - } - } - - private Boolean strikethrough; - public Boolean Strikethrough - { - get - { - return strikethrough; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.Strikethrough = value); - else - strikethrough = value; - } - } - - private XLFontVerticalTextAlignmentValues verticalAlignment; - public XLFontVerticalTextAlignmentValues VerticalAlignment - { - get - { - return verticalAlignment; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.VerticalAlignment = value); - else - verticalAlignment = value; - } - } - - private Boolean shadow; - public Boolean Shadow - { - get - { - return shadow; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.Shadow = value); - else - shadow = value; - } - } - - private Double fontSize; - public Double FontSize - { - get - { - return fontSize; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.FontSize = value); - else - fontSize = value; - } - } - - private Color fontColor; - public Color FontColor - { - get - { - return fontColor; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.FontColor = value); - else - fontColor = value; - } - } - - private String fontName; - public String FontName - { - get - { - return fontName; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.FontName = value); - else - fontName = value; - } - } - - private XLFontFamilyNumberingValues fontFamilyNumbering; - public XLFontFamilyNumberingValues FontFamilyNumbering - { - get - { - return fontFamilyNumbering; - } - set - { - if (container != null && !container.UpdatingStyle) - container.Styles.ForEach(s => s.Font.FontFamilyNumbering = value); - else - fontFamilyNumbering = value; - } - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs deleted file mode 100644 index e3e6c35..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public class XLNumberFormat: IXLNumberFormat - { - public uint? NumberFormatId { get; set; } - - public string Format { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs deleted file mode 100644 index b48a3a3..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OX.Copyable; - -namespace ClosedXML.Excel.Style -{ - public class XLStyle: IXLStyle - { - public XLStyle(IXLStylized container, IXLStyle initialStyle = null) - { - if (initialStyle != null) - { - //Font = new XLFont(container, initialStyle.Font); - Font = (IXLFont)initialStyle.Font.Copy(); - Alignment = (IXLAlignment)initialStyle.Alignment.Copy(); - Border = (IXLBorder)initialStyle.Border.Copy(); - Fill = (IXLFill)initialStyle.Fill.Copy(); - NumberFormat = (IXLNumberFormat)initialStyle.NumberFormat.Copy(); - } - else - { - //Font = new XLFont(container); - } - } - - public IXLFont Font { get; set; } - - public IXLAlignment Alignment { get; set; } - - public IXLBorder Border { get; set; } - - public IXLFill Fill { get; set; } - - public IXLNumberFormat NumberFormat { get; set; } - - public override string ToString() - { - return - "Font:" + Font.ToString() - + " Fill:" + Fill.ToString() - + " Border:" + Border.ToString() - + " NumberFormat: " + NumberFormat.ToString() - + " Alignment: " + Alignment.ToString(); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLAddress.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLAddress.cs deleted file mode 100644 index f5b5833..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLAddress.cs +++ /dev/null @@ -1,271 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; - -namespace ClosedXML.Excel -{ - public struct XLAddress: IXLAddress - { - #region Constructors - /// - /// Initializes a new struct using R1C1 notation. - /// - /// The row number of the cell address. - /// The column number of the cell address. - public XLAddress(Int32 row, Int32 column) - { - this.row = row; - this.column = column; - this.columnLetter = GetColumnLetterFromNumber(column); - } - - /// - /// Initializes a new struct using a mixed notation. - /// - /// The row number of the cell address. - /// The column letter of the cell address. - public XLAddress(Int32 row, String columnLetter) - { - this.row = row; - this.column = GetColumnNumberFromLetter(columnLetter); - this.columnLetter = columnLetter; - } - - - /// - /// Initializes a new struct using A1 notation. - /// - /// The cell address. - public XLAddress(String cellAddressString) - { - Match m = Regex.Match(cellAddressString, @"^([a-zA-Z]+)(\d+)$"); - columnLetter = m.Groups[1].Value; - this.row = Int32.Parse(m.Groups[2].Value); - this.column = GetColumnNumberFromLetter(columnLetter); - } - - #endregion - - #region Static - - /// - /// Gets the column number of a given column letter. - /// - /// The column letter to translate into a column number. - public static Int32 GetColumnNumberFromLetter(String column) - { - Int32 intColumnLetterLength = column.Length; - Int32 retVal = 0; - for (Int32 intCount = 0; intCount < intColumnLetterLength; intCount++) - { - retVal = retVal * 26 + (column.Substring(intCount, 1).ToUpper().ToCharArray()[0] - 64); - } - return (Int32)retVal; - } - - /// - /// Gets the column letter of a given column number. - /// - /// The column number to translate into a column letter. - public static String GetColumnLetterFromNumber(Int32 column) - { - String s = String.Empty; - for ( - Int32 i = Convert.ToInt32( - Math.Log( - Convert.ToDouble( - 25 * ( - Convert.ToDouble(column) - + 1 - ) - ) - ) / Math.Log(26) - ) - 1 - ; i >= 0 - ; i-- - ) - { - Int32 x = Convert.ToInt32(Math.Pow(26, i + 1) - 1) / 25 - 1; - if (column > x) - { - s += (Char)(((column - x - 1) / Convert.ToInt32(Math.Pow(26, i))) % 26 + 65); - } - } - return s; - } - - #endregion - - #region Properties - - private Int32 row; - /// - /// Gets the row number of this address. - /// - public Int32 Row - { - get { return row; } - private set { row = value; } - } - - private Int32 column; - /// - /// Gets the column number of this address. - /// - public Int32 Column - { - get { return column; } - private set { column = value; } - } - - private String columnLetter; - /// - /// Gets the column letter(s) of this address. - /// - public String ColumnLetter - { - get { return columnLetter; } - private set { columnLetter = value; } - } - - #endregion - - #region Overrides - public override string ToString() - { - return this.columnLetter + this.row.ToString(); - } - #endregion - - #region Operator Overloads - - public static XLAddress operator +(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return new XLAddress(xlCellAddressLeft.Row + xlCellAddressRight.Row, xlCellAddressLeft.Column + xlCellAddressRight.Column); - } - - public static XLAddress operator -(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return new XLAddress(xlCellAddressLeft.Row - xlCellAddressRight.Row, xlCellAddressLeft.Column - xlCellAddressRight.Column); - } - - public static XLAddress operator +(XLAddress xlCellAddressLeft, Int32 right) - { - return new XLAddress(xlCellAddressLeft.Row + right, xlCellAddressLeft.Column + right); - } - - public static XLAddress operator -(XLAddress xlCellAddressLeft, Int32 right) - { - return new XLAddress(xlCellAddressLeft.Row - right, xlCellAddressLeft.Column - right); - } - - public static Boolean operator ==(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return - xlCellAddressLeft.Row == xlCellAddressRight.Row - && xlCellAddressLeft.Column == xlCellAddressRight.Column; - } - - public static Boolean operator !=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight); - } - - public static Boolean operator >(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight) - && (xlCellAddressLeft.Row > xlCellAddressRight.Row || xlCellAddressLeft.Column > xlCellAddressRight.Column); - } - - public static Boolean operator <(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight) - && (xlCellAddressLeft.Row < xlCellAddressRight.Row || xlCellAddressLeft.Column < xlCellAddressRight.Column); - } - - public static Boolean operator >=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return xlCellAddressLeft == xlCellAddressRight || xlCellAddressLeft > xlCellAddressRight; - } - - public static Boolean operator <=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return xlCellAddressLeft == xlCellAddressRight || xlCellAddressLeft < xlCellAddressRight; - } - - #endregion - - #region Interface Requirements - - #region IEqualityComparer Members - - public Boolean Equals(XLAddress x, XLAddress y) - { - return x == y; - } - - public Int32 GetHashCode(XLAddress obj) - { - return obj.GetHashCode(); - } - - new public Boolean Equals(Object x, Object y) - { - return x == y; - } - - public Int32 GetHashCode(Object obj) - { - return obj.GetHashCode(); - } - - public override Int32 GetHashCode() - { - return this.ToString().GetHashCode(); - } - - #endregion - - #region IEquatable Members - - public Boolean Equals(XLAddress other) - { - return this == other; - } - - public override Boolean Equals(Object other) - { - return this == (XLAddress)other; - } - - #endregion - - #region IComparable Members - - public Int32 CompareTo(object obj) - { - var other = (XLAddress)obj; - if (this == other) - return 0; - else if (this > other) - return 1; - else - return -1; - } - - #endregion - - #region IComparable Members - - public int CompareTo(XLAddress other) - { - throw new NotImplementedException(); - } - - #endregion - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs deleted file mode 100644 index 7ce2db6..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLCell.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public class XLCell: IXLCell - { - public XLCell(IXLAddress address, IXLStyle defaultStyle) - { - this.Address = address; - Style = defaultStyle; - if (Style == null) Style = XLWorkbook.DefaultStyle; - } - public Boolean Initialized { get; private set; } - public IXLAddress Address { get; private set; } - - private String cellValue; - public String Value - { - get - { - return cellValue; - } - set - { - String val = value; - - Double dTest; - //DateTime dtTest; - Boolean bTest; - if (Double.TryParse(val, out dTest)) - { - DataType = XLCellValues.Number; - } - //else if (DateTime.TryParse(val, out dtTest)) - //{ - // DataType = XLCellValues.DateTime; - // Style.NumberFormat = new OPNumberFormat(14); - // val = dtTest.ToOADate().ToString(); - //} - else if (Boolean.TryParse(val, out bTest)) - { - DataType = XLCellValues.Boolean; - val = bTest ? "1" : "0"; - } - else - { - DataType = XLCellValues.SharedString; - } - cellValue = val; - } - } - - #region IXLStylized Members - - private IXLStyle style; - public IXLStyle Style - { - get - { - return style; - } - set - { - style = new XLStyle(null, value); - } - } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - yield return style; - UpdatingStyle = false; - } - } - - public Boolean UpdatingStyle { get; set; } - - #endregion - - - public XLCellValues DataType { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLColumn.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLColumn.cs deleted file mode 100644 index 33092d2..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLColumn.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public class XLColumn: IXLColumn - { - public XLColumn(Int32 column, Dictionary cellsCollection, IXLStyle defaultStyle) - { - FirstCellAddress = new XLAddress(1, column); - LastCellAddress = new XLAddress(XLWorksheet.MaxNumberOfRows, column); - CellsCollection = cellsCollection; - } - - public Int32 Width { get; set; } - - #region IXLRange Members - - public Dictionary CellsCollection { get; private set; } - public IXLAddress FirstCellAddress { get; private set; } - public IXLAddress LastCellAddress { get; private set; } - - #endregion - - #region IXLStylized Members - - private IXLStyle style; - public IXLStyle Style - { - get - { - return style; - } - set - { - style = new XLStyle(this, value); - } - } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - yield return style; - foreach (var c in CellsCollection.Values.Where(c => c.Address.Column == FirstCellAddress.Column)) - { - yield return c.Style; - } - UpdatingStyle = false; - } - } - - public Boolean UpdatingStyle { get; set; } - - #endregion - - #region IXLRange Members - - public IXLRange Row(int row) - { - var address = new XLAddress(row, FirstCellAddress.Column); - return this.Range(address, address); - } - - public IXLRange Column(int column) - { - return this; - } - - public IXLRange Column(string column) - { - return this; - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLRange.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLRange.cs deleted file mode 100644 index 256561b..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLRange.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public class XLRange: IXLRange - { - private IXLStyle defaultStyle; - public XLRange(IXLAddress firstCellAddress, IXLAddress lastCellAddress, Dictionary cellCollection) - { - FirstCellAddress = firstCellAddress; - LastCellAddress = lastCellAddress; - CellsCollection = cellCollection; - this.defaultStyle = new XLStyle(this, this.FirstCell().Style); - } - - #region IXLRange Members - - public Dictionary CellsCollection { get; private set; } - - public IXLAddress FirstCellAddress { get; private set; } - - public IXLAddress LastCellAddress { get; private set; } - - public IXLRange Row(Int32 row) - { - IXLAddress firstCellAddress = new XLAddress(row, 1); - IXLAddress lastCellAddress = new XLAddress(row, this.ColumnCount()); - return this.Range(firstCellAddress, lastCellAddress); - } - public IXLRange Column(Int32 column) - { - IXLAddress firstCellAddress = new XLAddress(1, column); - IXLAddress lastCellAddress = new XLAddress(this.RowCount(), column); - return this.Range(firstCellAddress, lastCellAddress); - } - public IXLRange Column(String column) - { - IXLAddress firstCellAddress = new XLAddress(1, column); - IXLAddress lastCellAddress = new XLAddress(this.RowCount(), column); - return this.Range(firstCellAddress, lastCellAddress); - } - - - #endregion - - #region IXLStylized Members - - public IXLStyle Style - { - get - { - return this.defaultStyle; - } - set - { - this.Cells().ForEach(c => c.Style = value); - } - } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - foreach (var cell in this.Cells()) - { - yield return cell.Style; - } - UpdatingStyle = false; - } - } - - public Boolean UpdatingStyle { get; set; } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLRow.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLRow.cs deleted file mode 100644 index 4433232..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLRow.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public class XLRow: IXLRange - { - public XLRow(Int32 row, Dictionary cellsCollection, IXLStyle defaultStyle) - { - FirstCellAddress = new XLAddress(row, 1); - LastCellAddress = new XLAddress(row, XLWorksheet.MaxNumberOfColumns); - CellsCollection = cellsCollection; - - var defaultAddress = new XLAddress(row, 0); - if (!cellsCollection.ContainsKey(defaultAddress)) - { - DefaultCell = new XLCell(defaultAddress, defaultStyle); - cellsCollection.Add(defaultAddress, DefaultCell); - } - else - { - DefaultCell = cellsCollection[defaultAddress]; - } - } - - private IXLCell DefaultCell { get; set; } - - #region IXLRange Members - - public Dictionary CellsCollection { get; private set; } - public IXLAddress FirstCellAddress { get; private set; } - public IXLAddress LastCellAddress { get; private set; } - - #endregion - - #region IXLStylized Members - - public IXLStyle Style - { - get - { - return DefaultCell.Style; - } - set - { - DefaultCell.Style = value; - } - } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - foreach (var c in CellsCollection.Values.Where(c => c.Address.Row == FirstCellAddress.Row)) - { - yield return c.Style; - } - UpdatingStyle = false; - } - } - - public Boolean UpdatingStyle { get; set; } - - #endregion - - - #region IXLRange Members - - public IXLRange Row(int row) - { - return this; - } - - public IXLRange Column(int column) - { - var address = new XLAddress(FirstCellAddress.Row, column); - return this.Range(address, address); - } - - public IXLRange Column(string column) - { - var address = new XLAddress(FirstCellAddress.Row, column); - return this.Range(address, address); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook.cs deleted file mode 100644 index b08d49a..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; -using System.IO; -using System.Drawing; - -namespace ClosedXML.Excel -{ - public partial class XLWorkbook: IXLWorkbook - { - public XLWorkbook() - { - Worksheets = new XLWorksheets(); - } - #region IXLWorkbook Members - - public IXLWorksheets Worksheets { get; private set; } - - /// - /// Gets the file name of the workbook. - /// - public String Name { get; private set; } - - /// - /// Gets the file name of the workbook including its full directory. - /// - public String FullName { get; private set; } - - public void SaveAs(String file, Boolean overwrite = false) - { - if (overwrite && File.Exists(file)) File.Delete(file); - - // For maintainability reasons the XLWorkbook class was divided into two files. - // The method CreatePackage can be located in the file XLWorkbook_Save.cs - CreatePackage(file); - } - - #endregion - - #region Static - - private static XLStyle defaultStyle; - /// - /// Gets the default style for new workbooks. - /// - public static XLStyle DefaultStyle - { - get - { - if (defaultStyle == null) - { - defaultStyle = new XLStyle(null, null) - { - Font = new XLFont(null, null) - { - Bold = false, - Italic = false, - Underline = XLFontUnderlineValues.None, - Strikethrough = false, - VerticalAlignment = XLFontVerticalTextAlignmentValues.Baseline, - FontSize = 11, - FontColor = Color.FromArgb(0,0,0), - FontName = "Calibri", - FontFamilyNumbering = XLFontFamilyNumberingValues.Swiss - } - , Alignment = new XLAlignment(), Border = new XLBorder(), NumberFormat = new XLNumberFormat(), - Fill = new XLFill(null) - { - BackgroundColor = Color.FromArgb(255,255,255), - PatternType = XLFillPatternValues.None, - PatternColor = Color.FromArgb(255, 255, 255) - } - //Border = new XLBorder(null) - // { - // BottomBorder = BorderStyleValues.None, - // DiagonalBorder = BorderStyleValues.None, - // DiagonalDown = false, - // DiagonalUp = false, - // LeftBorder = BorderStyleValues.None, - // RightBorder = BorderStyleValues.None, - // TopBorder = BorderStyleValues.None, - // BottomBorderColor = "000000", - // DiagonalBorderColor = "000000", - // LeftBorderColor = "000000", - // RightBorderColor = "000000", - // TopBorderColor = "000000" - // }, - //NumberFormat = new XLNumberFormat(0), - //Alignment = new XLAlignment(null) - // { - // Horizontal = HorizontalAlignmentValues.General, - // Indent = 0, - // JustifyLastLine = false, - // ReadingOrder = OPReadingOrders.ContextDependent, - // RelativeIndent = 0, - // ShrinkToFit = false, - // TextRotation = 0, - // Vertical = VerticalAlignmentValues.Bottom, - // WrapText = false - // } - }; - } - return defaultStyle; - } - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs deleted file mode 100644 index 8fbee37..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs +++ /dev/null @@ -1,1278 +0,0 @@ -using DocumentFormat.OpenXml.Packaging; -using Ap = DocumentFormat.OpenXml.ExtendedProperties; -using Vt = DocumentFormat.OpenXml.VariantTypes; -using DocumentFormat.OpenXml; -using DocumentFormat.OpenXml.Spreadsheet; -using A = DocumentFormat.OpenXml.Drawing; -using Xdr = DocumentFormat.OpenXml.Drawing.Spreadsheet; -using C = DocumentFormat.OpenXml.Drawing.Charts; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using ClosedXML.Excel.Style; - - -namespace ClosedXML.Excel -{ - public partial class XLWorkbook - { - - private Dictionary sharedStrings = new Dictionary(); - private struct FontInfo { public UInt32 FontId; public IXLFont Font; }; - private struct FillInfo { public UInt32 FillId; public IXLFill Fill; }; - private struct BorderInfo { public UInt32 BorderId; public IXLBorder Border; }; - private struct NumberFormatInfo { public UInt32 NumberFormatId; public IXLNumberFormat NumberFormat; }; - - - private struct StyleInfo - { - public UInt32 StyleId; - public UInt32 FontId; - public UInt32 FillId; - public UInt32 BorderId; - public UInt32 NumberFormatId; - public IXLStyle Style; - }; - - private Dictionary sharedStyles = new Dictionary(); - - private CellValues GetCellValue(XLCellValues xlCellValue) - { - switch (xlCellValue) - { - case XLCellValues.Boolean: return CellValues.Boolean; - case XLCellValues.DateTime: return CellValues.Date; - case XLCellValues.Number: return CellValues.Number; - case XLCellValues.SharedString: return CellValues.SharedString; - default: throw new NotImplementedException(); - } - } - - private UnderlineValues GetUnderlineValue(XLFontUnderlineValues xlFontUnderlineValue) - { - switch (xlFontUnderlineValue) - { - case XLFontUnderlineValues.Double: return UnderlineValues.Double; - case XLFontUnderlineValues.DoubleAccounting: return UnderlineValues.DoubleAccounting; - case XLFontUnderlineValues.None: return UnderlineValues.None; - case XLFontUnderlineValues.Single: return UnderlineValues.Single; - case XLFontUnderlineValues.SingleAccounting: return UnderlineValues.SingleAccounting; - default: throw new NotImplementedException(); - } - } - - private VerticalAlignmentRunValues GetVerticalAlignmentRunValue(XLFontVerticalTextAlignmentValues xlFontVerticalTextAlignmentValue) - { - switch (xlFontVerticalTextAlignmentValue) - { - case XLFontVerticalTextAlignmentValues.Baseline: return VerticalAlignmentRunValues.Baseline; - case XLFontVerticalTextAlignmentValues.Subscript: return VerticalAlignmentRunValues.Subscript; - case XLFontVerticalTextAlignmentValues.Superscript: return VerticalAlignmentRunValues.Superscript; - default: throw new NotImplementedException(); - } - } - - private PatternValues GetPatternValue(XLFillPatternValues xlFillPatternValue) - { - switch (xlFillPatternValue) - { - case XLFillPatternValues.DarkDown: return PatternValues.DarkDown; - case XLFillPatternValues.DarkGray: return PatternValues.DarkGray; - case XLFillPatternValues.DarkGrid: return PatternValues.DarkGrid; - case XLFillPatternValues.DarkHorizontal: return PatternValues.DarkHorizontal; - case XLFillPatternValues.DarkTrellis: return PatternValues.DarkTrellis; - case XLFillPatternValues.DarkUp: return PatternValues.DarkUp; - case XLFillPatternValues.DarkVertical: return PatternValues.DarkVertical; - case XLFillPatternValues.Gray0625: return PatternValues.Gray0625; - case XLFillPatternValues.Gray125: return PatternValues.Gray125; - case XLFillPatternValues.LightDown: return PatternValues.LightDown; - case XLFillPatternValues.LightGray: return PatternValues.LightGray; - case XLFillPatternValues.LightGrid: return PatternValues.LightGrid; - case XLFillPatternValues.LightHorizontal: return PatternValues.LightHorizontal; - case XLFillPatternValues.LightTrellis: return PatternValues.LightTrellis; - case XLFillPatternValues.LightUp: return PatternValues.LightUp; - case XLFillPatternValues.LightVertical: return PatternValues.LightVertical; - case XLFillPatternValues.MediumGray: return PatternValues.MediumGray; - case XLFillPatternValues.None: return PatternValues.None; - case XLFillPatternValues.Solid: return PatternValues.Solid; - default: throw new NotImplementedException(); - } - } - - private BorderStyleValues GetBorderStyleValue(XLBorderStyleValues xlBorderStyleValue) - { - switch (xlBorderStyleValue) - { - case XLBorderStyleValues.DashDot: return BorderStyleValues.DashDot; - case XLBorderStyleValues.DashDotDot: return BorderStyleValues.DashDotDot; - case XLBorderStyleValues.Dashed: return BorderStyleValues.Dashed; - case XLBorderStyleValues.Dotted: return BorderStyleValues.Dotted; - case XLBorderStyleValues.Double: return BorderStyleValues.Double; - case XLBorderStyleValues.Hair: return BorderStyleValues.Hair; - case XLBorderStyleValues.Medium: return BorderStyleValues.Medium; - case XLBorderStyleValues.MediumDashDot: return BorderStyleValues.MediumDashDot; - case XLBorderStyleValues.MediumDashDotDot: return BorderStyleValues.MediumDashDotDot; - case XLBorderStyleValues.MediumDashed: return BorderStyleValues.MediumDashed; - case XLBorderStyleValues.None: return BorderStyleValues.None; - case XLBorderStyleValues.SlantDashDot: return BorderStyleValues.SlantDashDot; - case XLBorderStyleValues.Thick: return BorderStyleValues.Thick; - case XLBorderStyleValues.Thin: return BorderStyleValues.Thin; - default: throw new NotImplementedException(); - } - } - - private HorizontalAlignmentValues GetHorizontalAlignmentValue(XLAlignmentHorizontalValues xlAlignmentHorizontalValue) - { - switch (xlAlignmentHorizontalValue) - { - case XLAlignmentHorizontalValues.Center: return HorizontalAlignmentValues.Center; - case XLAlignmentHorizontalValues.CenterContinuous: return HorizontalAlignmentValues.CenterContinuous; - case XLAlignmentHorizontalValues.Distributed: return HorizontalAlignmentValues.Distributed; - case XLAlignmentHorizontalValues.Fill: return HorizontalAlignmentValues.Fill; - case XLAlignmentHorizontalValues.General: return HorizontalAlignmentValues.General; - case XLAlignmentHorizontalValues.Justify: return HorizontalAlignmentValues.Justify; - case XLAlignmentHorizontalValues.Left: return HorizontalAlignmentValues.Left; - case XLAlignmentHorizontalValues.Right: return HorizontalAlignmentValues.Right; - default: throw new NotImplementedException(); - } - } - - private VerticalAlignmentValues GetVerticalAlignmentValue(XLAlignmentVerticalValues xlAlignmentVerticalValue) - { - switch (xlAlignmentVerticalValue) - { - case XLAlignmentVerticalValues.Bottom: return VerticalAlignmentValues.Bottom; - case XLAlignmentVerticalValues.Center: return VerticalAlignmentValues.Center; - case XLAlignmentVerticalValues.Distributed: return VerticalAlignmentValues.Distributed; - case XLAlignmentVerticalValues.Justify: return VerticalAlignmentValues.Justify; - case XLAlignmentVerticalValues.Top: return VerticalAlignmentValues.Top; - default: throw new NotImplementedException(); - } - } - - // Creates a SpreadsheetDocument. - private void CreatePackage(String filePath) - { - using (SpreadsheetDocument package = SpreadsheetDocument.Create(filePath, SpreadsheetDocumentType.Workbook)) - { - CreateParts(package); - } - } - - // Adds child parts and generates content of the specified part. - private void CreateParts(SpreadsheetDocument document) - { - ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart("rId3"); - GenerateExtendedFilePropertiesPartContent(extendedFilePropertiesPart1); - - WorkbookPart workbookPart = document.AddWorkbookPart(); - GenerateWorkbookPartContent(workbookPart); - - SharedStringTablePart sharedStringTablePart = workbookPart.AddNewPart("rId6"); - GenerateSharedStringTablePartContent(sharedStringTablePart); - - WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart("rId5"); - GenerateWorkbookStylesPartContent(workbookStylesPart); - - UInt32 sheetId = 0; - foreach (var worksheet in Worksheets) - { - sheetId++; - WorksheetPart worksheetPart = workbookPart.AddNewPart("rId" + sheetId.ToString()); - GenerateWorksheetPartContent(worksheetPart, worksheet); - } - - ThemePart themePart1 = workbookPart.AddNewPart("rId4"); - GenerateThemePartContent(themePart1); - - //SetPackageProperties(document); - } - - private void GenerateExtendedFilePropertiesPartContent(ExtendedFilePropertiesPart extendedFilePropertiesPart) - { - Ap.Properties properties1 = new Ap.Properties(); - properties1.AddNamespaceDeclaration("vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"); - Ap.Application application1 = new Ap.Application(); - application1.Text = "Microsoft Excel"; - Ap.DocumentSecurity documentSecurity1 = new Ap.DocumentSecurity(); - documentSecurity1.Text = "0"; - Ap.ScaleCrop scaleCrop1 = new Ap.ScaleCrop(); - scaleCrop1.Text = "false"; - - Ap.HeadingPairs headingPairs1 = new Ap.HeadingPairs(); - - Vt.VTVector vTVector1 = new Vt.VTVector() { BaseType = Vt.VectorBaseValues.Variant, Size = (UInt32Value)2U }; - - Vt.Variant variant1 = new Vt.Variant(); - Vt.VTLPSTR vTLPSTR1 = new Vt.VTLPSTR(); - vTLPSTR1.Text = "Worksheets"; - - variant1.Append(vTLPSTR1); - - Vt.Variant variant2 = new Vt.Variant(); - Vt.VTInt32 vTInt321 = new Vt.VTInt32(); - vTInt321.Text = "3"; - - variant2.Append(vTInt321); - - vTVector1.Append(variant1); - vTVector1.Append(variant2); - - headingPairs1.Append(vTVector1); - - Ap.TitlesOfParts titlesOfParts1 = new Ap.TitlesOfParts(); - - UInt32 sheetCount = (UInt32)Worksheets.Count(); - Vt.VTVector vTVector2 = new Vt.VTVector() { BaseType = Vt.VectorBaseValues.Lpstr, Size = (UInt32Value)sheetCount }; - foreach (var worksheet in Worksheets) - { - Vt.VTLPSTR vTLPSTR2 = new Vt.VTLPSTR(); - vTLPSTR2.Text = worksheet.Name; - vTVector2.Append(vTLPSTR2); - } - - titlesOfParts1.Append(vTVector2); - Ap.Company company1 = new Ap.Company(); - company1.Text = "NSI"; - Ap.LinksUpToDate linksUpToDate1 = new Ap.LinksUpToDate(); - linksUpToDate1.Text = "false"; - Ap.SharedDocument sharedDocument1 = new Ap.SharedDocument(); - sharedDocument1.Text = "false"; - Ap.HyperlinksChanged hyperlinksChanged1 = new Ap.HyperlinksChanged(); - hyperlinksChanged1.Text = "false"; - Ap.ApplicationVersion applicationVersion1 = new Ap.ApplicationVersion(); - applicationVersion1.Text = "12.0000"; - - properties1.Append(application1); - properties1.Append(documentSecurity1); - properties1.Append(scaleCrop1); - properties1.Append(headingPairs1); - properties1.Append(titlesOfParts1); - properties1.Append(company1); - properties1.Append(linksUpToDate1); - properties1.Append(sharedDocument1); - properties1.Append(hyperlinksChanged1); - properties1.Append(applicationVersion1); - - extendedFilePropertiesPart.Properties = properties1; - } - - private void GenerateWorkbookPartContent(WorkbookPart workbookPart) - { - Workbook workbook1 = new Workbook(); - workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); - FileVersion fileVersion1 = new FileVersion() { ApplicationName = "xl", LastEdited = "4", LowestEdited = "4", BuildVersion = "4506" }; - WorkbookProperties workbookProperties1 = new WorkbookProperties() { CodeName = "ThisWorkbook", DefaultThemeVersion = (UInt32Value)124226U }; - - BookViews bookViews1 = new BookViews(); - WorkbookView workbookView1 = new WorkbookView() { XWindow = 0, YWindow = 30, WindowWidth = (UInt32Value)14160U, WindowHeight = (UInt32Value)11580U }; - - bookViews1.Append(workbookView1); - - UInt32 sheetId = 0; - Sheets sheets = new Sheets(); - foreach (var worksheet in Worksheets) - { - sheetId++; - Sheet sheet = new Sheet() { Name = worksheet.Name, SheetId = (UInt32Value)sheetId, Id = "rId" + sheetId.ToString() }; - sheets.Append(sheet); - } - - CalculationProperties calculationProperties1 = new CalculationProperties() { CalculationId = (UInt32Value)125725U, CalculationMode = CalculateModeValues.Manual }; - - workbook1.Append(fileVersion1); - workbook1.Append(workbookProperties1); - workbook1.Append(bookViews1); - workbook1.Append(sheets); - workbook1.Append(calculationProperties1); - - workbookPart.Workbook = workbook1; - } - - private void GenerateSharedStringTablePartContent(SharedStringTablePart sharedStringTablePart) - { - List combined = new List(); - Worksheets.ForEach(w => combined.AddRange(w.CellsCollection.Values.Where(c => c.DataType == XLCellValues.SharedString && c.Value != null).Select(c => c.Value).Distinct())); - var distinctStrings = combined.Distinct(); - UInt32 stringCount = (UInt32)distinctStrings.Count(); - SharedStringTable sharedStringTable = new SharedStringTable() { Count = (UInt32Value)stringCount, UniqueCount = (UInt32Value)stringCount }; - - UInt32 stringId = 0; - foreach (var s in distinctStrings) - { - sharedStrings.Add(s, stringId++); - - SharedStringItem sharedStringItem = new SharedStringItem(); - Text text = new Text(); - text.Text = s; - sharedStringItem.Append(text); - sharedStringTable.Append(sharedStringItem); - } - - sharedStringTablePart.SharedStringTable = sharedStringTable; - } - - private void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart) - { - var defaultStyle = XLWorkbook.DefaultStyle; - Dictionary sharedFonts = new Dictionary(); - sharedFonts.Add(defaultStyle.Font.ToString(), new FontInfo() { FontId = 0, Font = defaultStyle.Font }); - - Dictionary sharedFills = new Dictionary(); - sharedFills.Add(defaultStyle.Fill.ToString(), new FillInfo() { FillId = 2, Fill = defaultStyle.Fill }); - - Dictionary sharedBorders = new Dictionary(); - sharedBorders.Add(defaultStyle.Border.ToString(), new BorderInfo() { BorderId = 0, Border = defaultStyle.Border }); - - Dictionary sharedNumberFormats = new Dictionary(); - sharedNumberFormats.Add(defaultStyle.NumberFormat.ToString(), new NumberFormatInfo() { NumberFormatId = 0, NumberFormat = defaultStyle.NumberFormat }); - - //Dictionary sharedAlignments = new Dictionary(); - //sharedAlignments.Add(defaultStyle.Alignment.ToString(), new AlignmentInfo() { AlignmentId = 0, Alignment = defaultStyle.Alignment }); - - sharedStyles.Add(defaultStyle.ToString(), - new StyleInfo() - { - StyleId = 0, - Style = defaultStyle, - FontId = 0, - FillId = 0, - BorderId = 0, - NumberFormatId = 0 - //AlignmentId = 0 - }); - - UInt32 styleCount = 1; - UInt32 fontCount = 1; - UInt32 fillCount = 3; - UInt32 borderCount = 1; - UInt32 numberFormatCount = 1; - - foreach (var worksheet in Worksheets) - { - foreach (var cell in worksheet.CellsCollection.Values) - { - if (!sharedFonts.ContainsKey(cell.Style.Font.ToString())) - { - sharedFonts.Add(cell.Style.Font.ToString(), new FontInfo() { FontId = fontCount++, Font = cell.Style.Font }); - } - - if (!sharedFills.ContainsKey(cell.Style.Fill.ToString())) - { - sharedFills.Add(cell.Style.Fill.ToString(), new FillInfo() { FillId = fillCount++, Fill = cell.Style.Fill }); - } - - if (!sharedBorders.ContainsKey(cell.Style.Border.ToString())) - { - sharedBorders.Add(cell.Style.Border.ToString(), new BorderInfo() { BorderId = borderCount++, Border = cell.Style.Border }); - } - - if (!cell.Style.NumberFormat.NumberFormatId.HasValue && !sharedNumberFormats.ContainsKey(cell.Style.NumberFormat.ToString())) - { - sharedNumberFormats.Add(cell.Style.NumberFormat.ToString(), new NumberFormatInfo() { NumberFormatId = numberFormatCount + 164, NumberFormat = cell.Style.NumberFormat }); - //cell.Style.NumberFormat = new OPNumberFormat(numberFormatCount); - numberFormatCount++; - } - //else if (!cell.Style.NumberFormat.NumberFormatId.HasValue) - //{ - // cell.Style.NumberFormat = new OPNumberFormat(sharedNumberFormats[cell.Style.NumberFormat.ToString()].NumberFormatId); - //} - - if (!sharedStyles.ContainsKey(cell.Style.ToString())) - { - UInt32 numberFormatId; - if (cell.Style.NumberFormat.NumberFormatId.HasValue) - numberFormatId = cell.Style.NumberFormat.NumberFormatId.Value; - else - numberFormatId = sharedNumberFormats[cell.Style.NumberFormat.ToString()].NumberFormatId; - - sharedStyles.Add(cell.Style.ToString(), - new StyleInfo() - { - StyleId = styleCount++, - Style = cell.Style, - FontId = sharedFonts[cell.Style.Font.ToString()].FontId, - FillId = sharedFills[cell.Style.Fill.ToString()].FillId, - BorderId = sharedBorders[cell.Style.Border.ToString()].BorderId, - NumberFormatId = numberFormatId - }); - } - } - } - - Stylesheet stylesheet1 = new Stylesheet(); - - NumberingFormats numberingFormats = new NumberingFormats() { Count = (UInt32Value)numberFormatCount }; - foreach (var numberFormatInfo in sharedNumberFormats.Values) - { - NumberingFormat numberingFormat = new NumberingFormat() { NumberFormatId = (UInt32Value)numberFormatInfo.NumberFormatId, FormatCode = numberFormatInfo.NumberFormat.Format }; - numberingFormats.Append(numberingFormat); - } - - Fonts fonts = new Fonts() { Count = (UInt32Value)fontCount }; - - foreach (var fontInfo in sharedFonts.Values) - { - Bold bold = fontInfo.Font.Bold ? new Bold() : null; - Italic italic = fontInfo.Font.Italic ? new Italic() : null; - Underline underline = fontInfo.Font.Underline != XLFontUnderlineValues.None ? new Underline() { Val = GetUnderlineValue(fontInfo.Font.Underline) } : null; - Strike strike = fontInfo.Font.Strikethrough ? new Strike() : null; - VerticalTextAlignment verticalAlignment = new VerticalTextAlignment() { Val = GetVerticalAlignmentRunValue(fontInfo.Font.VerticalAlignment) }; - Shadow shadow = fontInfo.Font.Shadow ? new Shadow() : null; - Font font = new Font(); - FontSize fontSize = new FontSize() { Val = fontInfo.Font.FontSize }; - Color color = new Color() { Rgb = fontInfo.Font.FontColor.ToHex() }; - FontName fontName = new FontName() { Val = fontInfo.Font.FontName }; - FontFamilyNumbering fontFamilyNumbering = new FontFamilyNumbering() { Val = (Int32)fontInfo.Font.FontFamilyNumbering }; - //FontScheme fontScheme = new FontScheme() { Val = FontSchemeValues.Minor }; - - if (bold != null) font.Append(bold); - if (italic != null) font.Append(italic); - if (underline != null) font.Append(underline); - if (strike != null) font.Append(strike); - font.Append(verticalAlignment); - if (shadow != null) font.Append(shadow); - font.Append(fontSize); - font.Append(color); - font.Append(fontName); - font.Append(fontFamilyNumbering); - //font.Append(fontScheme); - - fonts.Append(font); - } - - Fills fills = new Fills() { Count = (UInt32Value)fillCount }; - - Fill fill1 = new Fill(); - PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; - fill1.Append(patternFill1); - fills.Append(fill1); - - Fill fill2 = new Fill(); - PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; - fill2.Append(patternFill2); - fills.Append(fill2); - - foreach (var fillInfo in sharedFills.Values) - { - Fill fill = new Fill(); - PatternFill patternFill = new PatternFill() { PatternType = GetPatternValue(fillInfo.Fill.PatternType) }; - ForegroundColor foregroundColor = new ForegroundColor() { Rgb = fillInfo.Fill.PatternColor.ToHex() }; - BackgroundColor backgroundColor = new BackgroundColor() { Rgb = fillInfo.Fill.PatternBackgroundColor.ToHex() }; - - patternFill.Append(foregroundColor); - patternFill.Append(backgroundColor); - - fill.Append(patternFill); - fills.Append(fill); - } - - Borders borders = new Borders() { Count = (UInt32Value)borderCount }; - - foreach (var borderInfo in sharedBorders.Values) - { - Border border = new Border() { DiagonalUp = borderInfo.Border.DiagonalUp, DiagonalDown = borderInfo.Border.DiagonalDown }; - - LeftBorder leftBorder = new LeftBorder() { Style = GetBorderStyleValue(borderInfo.Border.LeftBorder) }; - Color leftBorderColor = new Color() { Rgb = borderInfo.Border.LeftBorderColor.ToHex() }; - leftBorder.Append(leftBorderColor); - border.Append(leftBorder); - - RightBorder rightBorder = new RightBorder() { Style = GetBorderStyleValue(borderInfo.Border.RightBorder) }; - Color rightBorderColor = new Color() { Rgb = borderInfo.Border.RightBorderColor.ToHex() }; - rightBorder.Append(rightBorderColor); - border.Append(rightBorder); - - TopBorder topBorder = new TopBorder() { Style = GetBorderStyleValue(borderInfo.Border.TopBorder) }; - Color topBorderColor = new Color() { Rgb = borderInfo.Border.TopBorderColor.ToHex() }; - topBorder.Append(topBorderColor); - border.Append(topBorder); - - BottomBorder bottomBorder = new BottomBorder() { Style = GetBorderStyleValue(borderInfo.Border.BottomBorder) }; - Color bottomBorderColor = new Color() { Rgb = borderInfo.Border.BottomBorderColor.ToHex() }; - bottomBorder.Append(bottomBorderColor); - border.Append(bottomBorder); - - DiagonalBorder diagonalBorder = new DiagonalBorder() { Style = GetBorderStyleValue(borderInfo.Border.DiagonalBorder) }; - Color diagonalBorderColor = new Color() { Rgb = borderInfo.Border.DiagonalBorderColor.ToHex() }; - diagonalBorder.Append(diagonalBorderColor); - border.Append(diagonalBorder); - - borders.Append(border); - } - - - - // Cell style formats = Formats to be used by the cells and named styles - CellStyleFormats cellStyleFormats = new CellStyleFormats() { Count = (UInt32Value)styleCount }; - // Cell formats = Any kind of formatting applied to a cell - CellFormats cellFormats = new CellFormats() { Count = (UInt32Value)styleCount }; - foreach (var styleInfo in sharedStyles.Values) - { - var formatId = styleInfo.StyleId; - var numberFormatId = styleInfo.NumberFormatId; - var fontId = styleInfo.FontId; - var fillId = styleInfo.FillId; - var borderId = styleInfo.BorderId; - Boolean applyFill = GetPatternValue(styleInfo.Style.Fill.PatternType) == PatternValues.None; - IXLBorder opBorder = styleInfo.Style.Border; - Boolean applyBorder = ( - GetBorderStyleValue(opBorder.BottomBorder) != BorderStyleValues.None - || GetBorderStyleValue(opBorder.DiagonalBorder) != BorderStyleValues.None - || GetBorderStyleValue(opBorder.RightBorder) != BorderStyleValues.None - || GetBorderStyleValue(opBorder.LeftBorder) != BorderStyleValues.None - || GetBorderStyleValue(opBorder.TopBorder) != BorderStyleValues.None); - - CellFormat cellStyleFormat = new CellFormat() { NumberFormatId = (UInt32Value)numberFormatId, FontId = (UInt32Value)fontId, FillId = (UInt32Value)fillId, BorderId = (UInt32Value)borderId, ApplyNumberFormat = false, ApplyFill = applyFill, ApplyBorder = applyBorder, ApplyAlignment = false, ApplyProtection = false }; - cellStyleFormats.Append(cellStyleFormat); - - CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)numberFormatId, FontId = (UInt32Value)fontId, FillId = (UInt32Value)fillId, BorderId = (UInt32Value)borderId, FormatId = (UInt32Value)formatId, ApplyNumberFormat = false, ApplyFill = applyFill, ApplyBorder = applyBorder, ApplyAlignment = false, ApplyProtection = false }; - Alignment alignment = new Alignment() - { - Horizontal = GetHorizontalAlignmentValue(styleInfo.Style.Alignment.Horizontal), - Vertical = GetVerticalAlignmentValue(styleInfo.Style.Alignment.Vertical), - Indent = styleInfo.Style.Alignment.Indent, - ReadingOrder = (UInt32)styleInfo.Style.Alignment.ReadingOrder, - WrapText = styleInfo.Style.Alignment.WrapText, - TextRotation = styleInfo.Style.Alignment.TextRotation, - ShrinkToFit = styleInfo.Style.Alignment.ShrinkToFit, - RelativeIndent = styleInfo.Style.Alignment.RelativeIndent, - JustifyLastLine = styleInfo.Style.Alignment.JustifyLastLine - }; - cellFormat.Append(alignment); - - cellFormats.Append(cellFormat); - } - - - - // Cell styles = Named styles - CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; - var defaultFormatId = sharedStyles.Values.Where(s => s.Style.ToString() == XLWorkbook.DefaultStyle.ToString()).Single().StyleId; - CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)defaultFormatId, BuiltinId = (UInt32Value)0U }; - cellStyles1.Append(cellStyle1); - - DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; - TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; - - stylesheet1.Append(numberingFormats); - stylesheet1.Append(fonts); - stylesheet1.Append(fills); - stylesheet1.Append(borders); - stylesheet1.Append(cellStyleFormats); - stylesheet1.Append(cellFormats); - stylesheet1.Append(cellStyles1); - stylesheet1.Append(differentialFormats1); - stylesheet1.Append(tableStyles1); - - workbookStylesPart.Stylesheet = stylesheet1; - } - - private void GenerateWorksheetPartContent(WorksheetPart worksheetPart, IXLWorksheet xlWorksheet) - { - Worksheet worksheet = new Worksheet(); - worksheet.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); - SheetProperties sheetProperties = new SheetProperties() { CodeName = xlWorksheet.Name.RemoveSpecialCharacters() }; - - UInt32 maxColumn = 0; - UInt32 maxRow = 0; - - String sheetDimensionReference = "A1"; - if (xlWorksheet.CellsCollection.Count > 0) - { - maxColumn = (UInt32)xlWorksheet.CellsCollection.Select(c => c.Key.Column).Max(); - maxRow = (UInt32)xlWorksheet.CellsCollection.Select(c => c.Key.Row).Max(); - sheetDimensionReference = "A1:" + new XLAddress((Int32)maxRow, (Int32)maxColumn).ToString(); - } - - SheetDimension sheetDimension = new SheetDimension() { Reference = sheetDimensionReference }; - - Boolean tabSelected = xlWorksheet.Name == Worksheets.GetWorksheet(0).Name; - - SheetViews sheetViews = new SheetViews(); - SheetView sheetView = new SheetView() { TabSelected = tabSelected, WorkbookViewId = (UInt32Value)0U }; - - sheetViews.Append(sheetView); - SheetFormatProperties sheetFormatProperties3 = new SheetFormatProperties() { DefaultRowHeight = 15D }; - - Columns columns = null; - //if (xlWorksheet.Columns.Count > 0) - //{ - // columns = new Columns(); - // foreach (var opColumn in xlWorksheet.Columns.Values) - // { - // Column column = new Column() - // { - // Min = (UInt32Value)opColumn.Column, - // Max = (UInt32Value)opColumn.Column, - // Width = opColumn.Width, - // CustomWidth = true - // }; - // columns.Append(column); - // } - //} - - SheetData sheetData = new SheetData(); - - var distinctRows = xlWorksheet.CellsCollection.Where(c => c.Key.Column > 0 && c.Key.Row > 0).Select(c => c.Key.Row).Distinct(); - foreach (var distinctRow in distinctRows.OrderBy(r => r)) - { - Row row = new Row() { RowIndex = (UInt32Value)(UInt32)distinctRow, Spans = new ListValue() { InnerText = "1:" + maxColumn.ToString() } }; - //if (xlWorksheet.Rows.ContainsKey(distinctRow)) - //{ - // row.Height = xlWorksheet.Rows[distinctRow].Height; - // row.CustomHeight = true; - //} - foreach (var opCell in xlWorksheet.CellsCollection - .Where(c => c.Key.Row == distinctRow && c.Key.Column != 0) - .OrderBy(c => c.Key) - .Select(c => c)) - { - var styleId = sharedStyles[opCell.Value.Style.ToString()].StyleId; - Cell cell; - var dataType = opCell.Value.DataType; - var cellReference = opCell.Key.ToString(); - if (opCell.Value.DataType == XLCellValues.DateTime) - { - cell = new Cell() - { - CellReference = cellReference, - StyleIndex = styleId - }; - } - else if (styleId == 0) - { - cell = new Cell() - { - CellReference = cellReference, - DataType = GetCellValue(dataType) - }; - } - else - { - cell = new Cell() - { - CellReference = cellReference, - DataType = GetCellValue(dataType), - StyleIndex = styleId - }; - } - CellValue cellValue = new CellValue(); - if (dataType == XLCellValues.SharedString) - { - cellValue.Text = sharedStrings[opCell.Value.Value].ToString(); - } - else - { - cellValue.Text = opCell.Value.Value; - } - - cell.Append(cellValue); - row.Append(cell); - } - sheetData.Append(row); - } - - MergeCells mergeCells = null; - //if (xlWorksheet.MergedCells.Count > 0) - //{ - // mergeCells = new MergeCells() { Count = (UInt32Value)(UInt32)xlWorksheet.MergedCells.Count }; - // foreach (var merged in xlWorksheet.MergedCells) - // { - // MergeCell mergeCell = new MergeCell() { Reference = merged }; - // mergeCells.Append(mergeCell); - // } - //} - - PageMargins pageMargins = new PageMargins() { Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D }; - Drawing drawing1 = new Drawing() { Id = "rId1" }; - worksheet.Append(sheetProperties); - worksheet.Append(sheetDimension); - worksheet.Append(sheetViews); - worksheet.Append(sheetFormatProperties3); - if (columns != null) worksheet.Append(columns); - worksheet.Append(sheetData); - if (mergeCells != null) worksheet.Append(mergeCells); - worksheet.Append(pageMargins); - //worksheet.Append(drawing1); - - worksheetPart.Worksheet = worksheet; - } - - private void GenerateThemePartContent(ThemePart themePart) - { - A.Theme theme1 = new A.Theme() { Name = "Office Theme" }; - theme1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); - - A.ThemeElements themeElements1 = new A.ThemeElements(); - - A.ColorScheme colorScheme1 = new A.ColorScheme() { Name = "Office" }; - - A.Dark1Color dark1Color1 = new A.Dark1Color(); - A.SystemColor systemColor1 = new A.SystemColor() { Val = A.SystemColorValues.WindowText, LastColor = "000000" }; - - dark1Color1.Append(systemColor1); - - A.Light1Color light1Color1 = new A.Light1Color(); - A.SystemColor systemColor2 = new A.SystemColor() { Val = A.SystemColorValues.Window, LastColor = "FFFFFF" }; - - light1Color1.Append(systemColor2); - - A.Dark2Color dark2Color1 = new A.Dark2Color(); - A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex() { Val = "1F497D" }; - - dark2Color1.Append(rgbColorModelHex1); - - A.Light2Color light2Color1 = new A.Light2Color(); - A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex() { Val = "EEECE1" }; - - light2Color1.Append(rgbColorModelHex2); - - A.Accent1Color accent1Color1 = new A.Accent1Color(); - A.RgbColorModelHex rgbColorModelHex3 = new A.RgbColorModelHex() { Val = "4F81BD" }; - - accent1Color1.Append(rgbColorModelHex3); - - A.Accent2Color accent2Color1 = new A.Accent2Color(); - A.RgbColorModelHex rgbColorModelHex4 = new A.RgbColorModelHex() { Val = "C0504D" }; - - accent2Color1.Append(rgbColorModelHex4); - - A.Accent3Color accent3Color1 = new A.Accent3Color(); - A.RgbColorModelHex rgbColorModelHex5 = new A.RgbColorModelHex() { Val = "9BBB59" }; - - accent3Color1.Append(rgbColorModelHex5); - - A.Accent4Color accent4Color1 = new A.Accent4Color(); - A.RgbColorModelHex rgbColorModelHex6 = new A.RgbColorModelHex() { Val = "8064A2" }; - - accent4Color1.Append(rgbColorModelHex6); - - A.Accent5Color accent5Color1 = new A.Accent5Color(); - A.RgbColorModelHex rgbColorModelHex7 = new A.RgbColorModelHex() { Val = "4BACC6" }; - - accent5Color1.Append(rgbColorModelHex7); - - A.Accent6Color accent6Color1 = new A.Accent6Color(); - A.RgbColorModelHex rgbColorModelHex8 = new A.RgbColorModelHex() { Val = "F79646" }; - - accent6Color1.Append(rgbColorModelHex8); - - A.Hyperlink hyperlink1 = new A.Hyperlink(); - A.RgbColorModelHex rgbColorModelHex9 = new A.RgbColorModelHex() { Val = "0000FF" }; - - hyperlink1.Append(rgbColorModelHex9); - - A.FollowedHyperlinkColor followedHyperlinkColor1 = new A.FollowedHyperlinkColor(); - A.RgbColorModelHex rgbColorModelHex10 = new A.RgbColorModelHex() { Val = "800080" }; - - followedHyperlinkColor1.Append(rgbColorModelHex10); - - colorScheme1.Append(dark1Color1); - colorScheme1.Append(light1Color1); - colorScheme1.Append(dark2Color1); - colorScheme1.Append(light2Color1); - colorScheme1.Append(accent1Color1); - colorScheme1.Append(accent2Color1); - colorScheme1.Append(accent3Color1); - colorScheme1.Append(accent4Color1); - colorScheme1.Append(accent5Color1); - colorScheme1.Append(accent6Color1); - colorScheme1.Append(hyperlink1); - colorScheme1.Append(followedHyperlinkColor1); - - A.FontScheme fontScheme2 = new A.FontScheme() { Name = "Office" }; - - A.MajorFont majorFont1 = new A.MajorFont(); - A.LatinFont latinFont1 = new A.LatinFont() { Typeface = "Cambria" }; - A.EastAsianFont eastAsianFont1 = new A.EastAsianFont() { Typeface = "" }; - A.ComplexScriptFont complexScriptFont1 = new A.ComplexScriptFont() { Typeface = "" }; - A.SupplementalFont supplementalFont1 = new A.SupplementalFont() { Script = "Jpan", Typeface = "MS Pゴシック" }; - A.SupplementalFont supplementalFont2 = new A.SupplementalFont() { Script = "Hang", Typeface = "맑은 고딕" }; - A.SupplementalFont supplementalFont3 = new A.SupplementalFont() { Script = "Hans", Typeface = "宋体" }; - A.SupplementalFont supplementalFont4 = new A.SupplementalFont() { Script = "Hant", Typeface = "新細明體" }; - A.SupplementalFont supplementalFont5 = new A.SupplementalFont() { Script = "Arab", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont6 = new A.SupplementalFont() { Script = "Hebr", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont7 = new A.SupplementalFont() { Script = "Thai", Typeface = "Tahoma" }; - A.SupplementalFont supplementalFont8 = new A.SupplementalFont() { Script = "Ethi", Typeface = "Nyala" }; - A.SupplementalFont supplementalFont9 = new A.SupplementalFont() { Script = "Beng", Typeface = "Vrinda" }; - A.SupplementalFont supplementalFont10 = new A.SupplementalFont() { Script = "Gujr", Typeface = "Shruti" }; - A.SupplementalFont supplementalFont11 = new A.SupplementalFont() { Script = "Khmr", Typeface = "MoolBoran" }; - A.SupplementalFont supplementalFont12 = new A.SupplementalFont() { Script = "Knda", Typeface = "Tunga" }; - A.SupplementalFont supplementalFont13 = new A.SupplementalFont() { Script = "Guru", Typeface = "Raavi" }; - A.SupplementalFont supplementalFont14 = new A.SupplementalFont() { Script = "Cans", Typeface = "Euphemia" }; - A.SupplementalFont supplementalFont15 = new A.SupplementalFont() { Script = "Cher", Typeface = "Plantagenet Cherokee" }; - A.SupplementalFont supplementalFont16 = new A.SupplementalFont() { Script = "Yiii", Typeface = "Microsoft Yi Baiti" }; - A.SupplementalFont supplementalFont17 = new A.SupplementalFont() { Script = "Tibt", Typeface = "Microsoft Himalaya" }; - A.SupplementalFont supplementalFont18 = new A.SupplementalFont() { Script = "Thaa", Typeface = "MV Boli" }; - A.SupplementalFont supplementalFont19 = new A.SupplementalFont() { Script = "Deva", Typeface = "Mangal" }; - A.SupplementalFont supplementalFont20 = new A.SupplementalFont() { Script = "Telu", Typeface = "Gautami" }; - A.SupplementalFont supplementalFont21 = new A.SupplementalFont() { Script = "Taml", Typeface = "Latha" }; - A.SupplementalFont supplementalFont22 = new A.SupplementalFont() { Script = "Syrc", Typeface = "Estrangelo Edessa" }; - A.SupplementalFont supplementalFont23 = new A.SupplementalFont() { Script = "Orya", Typeface = "Kalinga" }; - A.SupplementalFont supplementalFont24 = new A.SupplementalFont() { Script = "Mlym", Typeface = "Kartika" }; - A.SupplementalFont supplementalFont25 = new A.SupplementalFont() { Script = "Laoo", Typeface = "DokChampa" }; - A.SupplementalFont supplementalFont26 = new A.SupplementalFont() { Script = "Sinh", Typeface = "Iskoola Pota" }; - A.SupplementalFont supplementalFont27 = new A.SupplementalFont() { Script = "Mong", Typeface = "Mongolian Baiti" }; - A.SupplementalFont supplementalFont28 = new A.SupplementalFont() { Script = "Viet", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont29 = new A.SupplementalFont() { Script = "Uigh", Typeface = "Microsoft Uighur" }; - - majorFont1.Append(latinFont1); - majorFont1.Append(eastAsianFont1); - majorFont1.Append(complexScriptFont1); - majorFont1.Append(supplementalFont1); - majorFont1.Append(supplementalFont2); - majorFont1.Append(supplementalFont3); - majorFont1.Append(supplementalFont4); - majorFont1.Append(supplementalFont5); - majorFont1.Append(supplementalFont6); - majorFont1.Append(supplementalFont7); - majorFont1.Append(supplementalFont8); - majorFont1.Append(supplementalFont9); - majorFont1.Append(supplementalFont10); - majorFont1.Append(supplementalFont11); - majorFont1.Append(supplementalFont12); - majorFont1.Append(supplementalFont13); - majorFont1.Append(supplementalFont14); - majorFont1.Append(supplementalFont15); - majorFont1.Append(supplementalFont16); - majorFont1.Append(supplementalFont17); - majorFont1.Append(supplementalFont18); - majorFont1.Append(supplementalFont19); - majorFont1.Append(supplementalFont20); - majorFont1.Append(supplementalFont21); - majorFont1.Append(supplementalFont22); - majorFont1.Append(supplementalFont23); - majorFont1.Append(supplementalFont24); - majorFont1.Append(supplementalFont25); - majorFont1.Append(supplementalFont26); - majorFont1.Append(supplementalFont27); - majorFont1.Append(supplementalFont28); - majorFont1.Append(supplementalFont29); - - A.MinorFont minorFont1 = new A.MinorFont(); - A.LatinFont latinFont2 = new A.LatinFont() { Typeface = "Calibri" }; - A.EastAsianFont eastAsianFont2 = new A.EastAsianFont() { Typeface = "" }; - A.ComplexScriptFont complexScriptFont2 = new A.ComplexScriptFont() { Typeface = "" }; - A.SupplementalFont supplementalFont30 = new A.SupplementalFont() { Script = "Jpan", Typeface = "MS Pゴシック" }; - A.SupplementalFont supplementalFont31 = new A.SupplementalFont() { Script = "Hang", Typeface = "맑은 고딕" }; - A.SupplementalFont supplementalFont32 = new A.SupplementalFont() { Script = "Hans", Typeface = "宋体" }; - A.SupplementalFont supplementalFont33 = new A.SupplementalFont() { Script = "Hant", Typeface = "新細明體" }; - A.SupplementalFont supplementalFont34 = new A.SupplementalFont() { Script = "Arab", Typeface = "Arial" }; - A.SupplementalFont supplementalFont35 = new A.SupplementalFont() { Script = "Hebr", Typeface = "Arial" }; - A.SupplementalFont supplementalFont36 = new A.SupplementalFont() { Script = "Thai", Typeface = "Tahoma" }; - A.SupplementalFont supplementalFont37 = new A.SupplementalFont() { Script = "Ethi", Typeface = "Nyala" }; - A.SupplementalFont supplementalFont38 = new A.SupplementalFont() { Script = "Beng", Typeface = "Vrinda" }; - A.SupplementalFont supplementalFont39 = new A.SupplementalFont() { Script = "Gujr", Typeface = "Shruti" }; - A.SupplementalFont supplementalFont40 = new A.SupplementalFont() { Script = "Khmr", Typeface = "DaunPenh" }; - A.SupplementalFont supplementalFont41 = new A.SupplementalFont() { Script = "Knda", Typeface = "Tunga" }; - A.SupplementalFont supplementalFont42 = new A.SupplementalFont() { Script = "Guru", Typeface = "Raavi" }; - A.SupplementalFont supplementalFont43 = new A.SupplementalFont() { Script = "Cans", Typeface = "Euphemia" }; - A.SupplementalFont supplementalFont44 = new A.SupplementalFont() { Script = "Cher", Typeface = "Plantagenet Cherokee" }; - A.SupplementalFont supplementalFont45 = new A.SupplementalFont() { Script = "Yiii", Typeface = "Microsoft Yi Baiti" }; - A.SupplementalFont supplementalFont46 = new A.SupplementalFont() { Script = "Tibt", Typeface = "Microsoft Himalaya" }; - A.SupplementalFont supplementalFont47 = new A.SupplementalFont() { Script = "Thaa", Typeface = "MV Boli" }; - A.SupplementalFont supplementalFont48 = new A.SupplementalFont() { Script = "Deva", Typeface = "Mangal" }; - A.SupplementalFont supplementalFont49 = new A.SupplementalFont() { Script = "Telu", Typeface = "Gautami" }; - A.SupplementalFont supplementalFont50 = new A.SupplementalFont() { Script = "Taml", Typeface = "Latha" }; - A.SupplementalFont supplementalFont51 = new A.SupplementalFont() { Script = "Syrc", Typeface = "Estrangelo Edessa" }; - A.SupplementalFont supplementalFont52 = new A.SupplementalFont() { Script = "Orya", Typeface = "Kalinga" }; - A.SupplementalFont supplementalFont53 = new A.SupplementalFont() { Script = "Mlym", Typeface = "Kartika" }; - A.SupplementalFont supplementalFont54 = new A.SupplementalFont() { Script = "Laoo", Typeface = "DokChampa" }; - A.SupplementalFont supplementalFont55 = new A.SupplementalFont() { Script = "Sinh", Typeface = "Iskoola Pota" }; - A.SupplementalFont supplementalFont56 = new A.SupplementalFont() { Script = "Mong", Typeface = "Mongolian Baiti" }; - A.SupplementalFont supplementalFont57 = new A.SupplementalFont() { Script = "Viet", Typeface = "Arial" }; - A.SupplementalFont supplementalFont58 = new A.SupplementalFont() { Script = "Uigh", Typeface = "Microsoft Uighur" }; - - minorFont1.Append(latinFont2); - minorFont1.Append(eastAsianFont2); - minorFont1.Append(complexScriptFont2); - minorFont1.Append(supplementalFont30); - minorFont1.Append(supplementalFont31); - minorFont1.Append(supplementalFont32); - minorFont1.Append(supplementalFont33); - minorFont1.Append(supplementalFont34); - minorFont1.Append(supplementalFont35); - minorFont1.Append(supplementalFont36); - minorFont1.Append(supplementalFont37); - minorFont1.Append(supplementalFont38); - minorFont1.Append(supplementalFont39); - minorFont1.Append(supplementalFont40); - minorFont1.Append(supplementalFont41); - minorFont1.Append(supplementalFont42); - minorFont1.Append(supplementalFont43); - minorFont1.Append(supplementalFont44); - minorFont1.Append(supplementalFont45); - minorFont1.Append(supplementalFont46); - minorFont1.Append(supplementalFont47); - minorFont1.Append(supplementalFont48); - minorFont1.Append(supplementalFont49); - minorFont1.Append(supplementalFont50); - minorFont1.Append(supplementalFont51); - minorFont1.Append(supplementalFont52); - minorFont1.Append(supplementalFont53); - minorFont1.Append(supplementalFont54); - minorFont1.Append(supplementalFont55); - minorFont1.Append(supplementalFont56); - minorFont1.Append(supplementalFont57); - minorFont1.Append(supplementalFont58); - - fontScheme2.Append(majorFont1); - fontScheme2.Append(minorFont1); - - A.FormatScheme formatScheme1 = new A.FormatScheme() { Name = "Office" }; - - A.FillStyleList fillStyleList1 = new A.FillStyleList(); - - A.SolidFill solidFill1 = new A.SolidFill(); - A.SchemeColor schemeColor1 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill1.Append(schemeColor1); - - A.GradientFill gradientFill1 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList1 = new A.GradientStopList(); - - A.GradientStop gradientStop1 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor2 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint1 = new A.Tint() { Val = 50000 }; - A.SaturationModulation saturationModulation1 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor2.Append(tint1); - schemeColor2.Append(saturationModulation1); - - gradientStop1.Append(schemeColor2); - - A.GradientStop gradientStop2 = new A.GradientStop() { Position = 35000 }; - - A.SchemeColor schemeColor3 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint2 = new A.Tint() { Val = 37000 }; - A.SaturationModulation saturationModulation2 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor3.Append(tint2); - schemeColor3.Append(saturationModulation2); - - gradientStop2.Append(schemeColor3); - - A.GradientStop gradientStop3 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor4 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint3 = new A.Tint() { Val = 15000 }; - A.SaturationModulation saturationModulation3 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor4.Append(tint3); - schemeColor4.Append(saturationModulation3); - - gradientStop3.Append(schemeColor4); - - gradientStopList1.Append(gradientStop1); - gradientStopList1.Append(gradientStop2); - gradientStopList1.Append(gradientStop3); - A.LinearGradientFill linearGradientFill1 = new A.LinearGradientFill() { Angle = 16200000, Scaled = true }; - - gradientFill1.Append(gradientStopList1); - gradientFill1.Append(linearGradientFill1); - - A.GradientFill gradientFill2 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList2 = new A.GradientStopList(); - - A.GradientStop gradientStop4 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor5 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade1 = new A.Shade() { Val = 51000 }; - A.SaturationModulation saturationModulation4 = new A.SaturationModulation() { Val = 130000 }; - - schemeColor5.Append(shade1); - schemeColor5.Append(saturationModulation4); - - gradientStop4.Append(schemeColor5); - - A.GradientStop gradientStop5 = new A.GradientStop() { Position = 80000 }; - - A.SchemeColor schemeColor6 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade2 = new A.Shade() { Val = 93000 }; - A.SaturationModulation saturationModulation5 = new A.SaturationModulation() { Val = 130000 }; - - schemeColor6.Append(shade2); - schemeColor6.Append(saturationModulation5); - - gradientStop5.Append(schemeColor6); - - A.GradientStop gradientStop6 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor7 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade3 = new A.Shade() { Val = 94000 }; - A.SaturationModulation saturationModulation6 = new A.SaturationModulation() { Val = 135000 }; - - schemeColor7.Append(shade3); - schemeColor7.Append(saturationModulation6); - - gradientStop6.Append(schemeColor7); - - gradientStopList2.Append(gradientStop4); - gradientStopList2.Append(gradientStop5); - gradientStopList2.Append(gradientStop6); - A.LinearGradientFill linearGradientFill2 = new A.LinearGradientFill() { Angle = 16200000, Scaled = false }; - - gradientFill2.Append(gradientStopList2); - gradientFill2.Append(linearGradientFill2); - - fillStyleList1.Append(solidFill1); - fillStyleList1.Append(gradientFill1); - fillStyleList1.Append(gradientFill2); - - A.LineStyleList lineStyleList1 = new A.LineStyleList(); - - A.Outline outline1 = new A.Outline() { Width = 9525, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill2 = new A.SolidFill(); - - A.SchemeColor schemeColor8 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade4 = new A.Shade() { Val = 95000 }; - A.SaturationModulation saturationModulation7 = new A.SaturationModulation() { Val = 105000 }; - - schemeColor8.Append(shade4); - schemeColor8.Append(saturationModulation7); - - solidFill2.Append(schemeColor8); - A.PresetDash presetDash1 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline1.Append(solidFill2); - outline1.Append(presetDash1); - - A.Outline outline2 = new A.Outline() { Width = 25400, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill3 = new A.SolidFill(); - A.SchemeColor schemeColor9 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill3.Append(schemeColor9); - A.PresetDash presetDash2 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline2.Append(solidFill3); - outline2.Append(presetDash2); - - A.Outline outline3 = new A.Outline() { Width = 38100, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill4 = new A.SolidFill(); - A.SchemeColor schemeColor10 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill4.Append(schemeColor10); - A.PresetDash presetDash3 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline3.Append(solidFill4); - outline3.Append(presetDash3); - - lineStyleList1.Append(outline1); - lineStyleList1.Append(outline2); - lineStyleList1.Append(outline3); - - A.EffectStyleList effectStyleList1 = new A.EffectStyleList(); - - A.EffectStyle effectStyle1 = new A.EffectStyle(); - - A.EffectList effectList1 = new A.EffectList(); - - A.OuterShadow outerShadow1 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 20000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex11 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha1 = new A.Alpha() { Val = 38000 }; - - rgbColorModelHex11.Append(alpha1); - - outerShadow1.Append(rgbColorModelHex11); - - effectList1.Append(outerShadow1); - - effectStyle1.Append(effectList1); - - A.EffectStyle effectStyle2 = new A.EffectStyle(); - - A.EffectList effectList2 = new A.EffectList(); - - A.OuterShadow outerShadow2 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 23000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex12 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha2 = new A.Alpha() { Val = 35000 }; - - rgbColorModelHex12.Append(alpha2); - - outerShadow2.Append(rgbColorModelHex12); - - effectList2.Append(outerShadow2); - - effectStyle2.Append(effectList2); - - A.EffectStyle effectStyle3 = new A.EffectStyle(); - - A.EffectList effectList3 = new A.EffectList(); - - A.OuterShadow outerShadow3 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 23000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex13 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha3 = new A.Alpha() { Val = 35000 }; - - rgbColorModelHex13.Append(alpha3); - - outerShadow3.Append(rgbColorModelHex13); - - effectList3.Append(outerShadow3); - - A.Scene3DType scene3DType1 = new A.Scene3DType(); - - A.Camera camera1 = new A.Camera() { Preset = A.PresetCameraValues.OrthographicFront }; - A.Rotation rotation1 = new A.Rotation() { Latitude = 0, Longitude = 0, Revolution = 0 }; - - camera1.Append(rotation1); - - A.LightRig lightRig1 = new A.LightRig() { Rig = A.LightRigValues.ThreePoints, Direction = A.LightRigDirectionValues.Top }; - A.Rotation rotation2 = new A.Rotation() { Latitude = 0, Longitude = 0, Revolution = 1200000 }; - - lightRig1.Append(rotation2); - - scene3DType1.Append(camera1); - scene3DType1.Append(lightRig1); - - A.Shape3DType shape3DType1 = new A.Shape3DType(); - A.BevelTop bevelTop1 = new A.BevelTop() { Width = 63500L, Height = 25400L }; - - shape3DType1.Append(bevelTop1); - - effectStyle3.Append(effectList3); - effectStyle3.Append(scene3DType1); - effectStyle3.Append(shape3DType1); - - effectStyleList1.Append(effectStyle1); - effectStyleList1.Append(effectStyle2); - effectStyleList1.Append(effectStyle3); - - A.BackgroundFillStyleList backgroundFillStyleList1 = new A.BackgroundFillStyleList(); - - A.SolidFill solidFill5 = new A.SolidFill(); - A.SchemeColor schemeColor11 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill5.Append(schemeColor11); - - A.GradientFill gradientFill3 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList3 = new A.GradientStopList(); - - A.GradientStop gradientStop7 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor12 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint4 = new A.Tint() { Val = 40000 }; - A.SaturationModulation saturationModulation8 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor12.Append(tint4); - schemeColor12.Append(saturationModulation8); - - gradientStop7.Append(schemeColor12); - - A.GradientStop gradientStop8 = new A.GradientStop() { Position = 40000 }; - - A.SchemeColor schemeColor13 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint5 = new A.Tint() { Val = 45000 }; - A.Shade shade5 = new A.Shade() { Val = 99000 }; - A.SaturationModulation saturationModulation9 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor13.Append(tint5); - schemeColor13.Append(shade5); - schemeColor13.Append(saturationModulation9); - - gradientStop8.Append(schemeColor13); - - A.GradientStop gradientStop9 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor14 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade6 = new A.Shade() { Val = 20000 }; - A.SaturationModulation saturationModulation10 = new A.SaturationModulation() { Val = 255000 }; - - schemeColor14.Append(shade6); - schemeColor14.Append(saturationModulation10); - - gradientStop9.Append(schemeColor14); - - gradientStopList3.Append(gradientStop7); - gradientStopList3.Append(gradientStop8); - gradientStopList3.Append(gradientStop9); - - A.PathGradientFill pathGradientFill1 = new A.PathGradientFill() { Path = A.PathShadeValues.Circle }; - A.FillToRectangle fillToRectangle1 = new A.FillToRectangle() { Left = 50000, Top = -80000, Right = 50000, Bottom = 180000 }; - - pathGradientFill1.Append(fillToRectangle1); - - gradientFill3.Append(gradientStopList3); - gradientFill3.Append(pathGradientFill1); - - A.GradientFill gradientFill4 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList4 = new A.GradientStopList(); - - A.GradientStop gradientStop10 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor15 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint6 = new A.Tint() { Val = 80000 }; - A.SaturationModulation saturationModulation11 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor15.Append(tint6); - schemeColor15.Append(saturationModulation11); - - gradientStop10.Append(schemeColor15); - - A.GradientStop gradientStop11 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor16 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade7 = new A.Shade() { Val = 30000 }; - A.SaturationModulation saturationModulation12 = new A.SaturationModulation() { Val = 200000 }; - - schemeColor16.Append(shade7); - schemeColor16.Append(saturationModulation12); - - gradientStop11.Append(schemeColor16); - - gradientStopList4.Append(gradientStop10); - gradientStopList4.Append(gradientStop11); - - A.PathGradientFill pathGradientFill2 = new A.PathGradientFill() { Path = A.PathShadeValues.Circle }; - A.FillToRectangle fillToRectangle2 = new A.FillToRectangle() { Left = 50000, Top = 50000, Right = 50000, Bottom = 50000 }; - - pathGradientFill2.Append(fillToRectangle2); - - gradientFill4.Append(gradientStopList4); - gradientFill4.Append(pathGradientFill2); - - backgroundFillStyleList1.Append(solidFill5); - backgroundFillStyleList1.Append(gradientFill3); - backgroundFillStyleList1.Append(gradientFill4); - - formatScheme1.Append(fillStyleList1); - formatScheme1.Append(lineStyleList1); - formatScheme1.Append(effectStyleList1); - formatScheme1.Append(backgroundFillStyleList1); - - themeElements1.Append(colorScheme1); - themeElements1.Append(fontScheme2); - themeElements1.Append(formatScheme1); - A.ObjectDefaults objectDefaults1 = new A.ObjectDefaults(); - A.ExtraColorSchemeList extraColorSchemeList1 = new A.ExtraColorSchemeList(); - - theme1.Append(themeElements1); - theme1.Append(objectDefaults1); - theme1.Append(extraColorSchemeList1); - - themePart.Theme = theme1; - } - - private void SetPackageProperties(OpenXmlPackage document) - { - document.PackageProperties.Creator = Environment.UserName; - document.PackageProperties.Created = DateTime.Now; - document.PackageProperties.Modified = DateTime.Now; - document.PackageProperties.LastModifiedBy = Environment.UserName; - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheet.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheet.cs deleted file mode 100644 index f03de68..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheet.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public class XLWorksheet: IXLWorksheet - { - #region Constants - - public const Int32 MaxNumberOfRows = 1048576; - public const Int32 MaxNumberOfColumns = 16384; - - #endregion - - Dictionary cellsCollection = new Dictionary(); - - public XLWorksheet(String sheetName) - { - var defaultAddress = new XLAddress(0,0); - DefaultCell = new XLCell(defaultAddress, XLWorkbook.DefaultStyle); - cellsCollection.Add(defaultAddress, DefaultCell); - this.Name = sheetName; - } - - #region IXLRange Members - - public Dictionary CellsCollection - { - get { return cellsCollection; } - } - - public IXLAddress FirstCellAddress - { - get { return new XLAddress(1, 1); } - } - - public IXLAddress LastCellAddress - { - get { return new XLAddress(MaxNumberOfRows, MaxNumberOfColumns); } - } - - private IXLCell DefaultCell { get; set; } - - #endregion - - #region IXLStylized Members - - public IXLStyle Style - { - get - { - return DefaultCell.Style; - } - set - { - DefaultCell.Style = value; - } - } - - public IEnumerable Styles - { - get - { - UpdatingStyle = true; - foreach (var c in cellsCollection.Values) - { - yield return c.Style; - } - UpdatingStyle = false; - } - } - - public Boolean UpdatingStyle { get; set; } - - #endregion - - public IXLRange Row(Int32 row) - { - return new XLRow(row, cellsCollection, Style); - } - public IXLColumn Column(Int32 column) - { - return new XLColumn(column, cellsCollection, Style); - } - public IXLColumn Column(String column) - { - return new XLColumn(XLAddress.GetColumnNumberFromLetter(column), cellsCollection, Style); - } - - #region IXLRange Members - - - IXLRange IXLRange.Column(int column) - { - IXLAddress firstCellAddress = new XLAddress(1, column); - IXLAddress lastCellAddress = new XLAddress(MaxNumberOfRows, column); - return this.Range(firstCellAddress, lastCellAddress); - } - - IXLRange IXLRange.Column(string column) - { - IXLAddress firstCellAddress = new XLAddress(1, column); - IXLAddress lastCellAddress = new XLAddress(MaxNumberOfRows, column); - return this.Range(firstCellAddress, lastCellAddress); - } - - #endregion - - - public String Name { get; set; } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheets.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheets.cs deleted file mode 100644 index 5db3550..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorksheets.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - public class XLWorksheets: IXLWorksheets - { - Dictionary worksheets = new Dictionary(); - - #region IXLWorksheets Members - - public IXLWorksheet GetWorksheet(string sheetName) - { - return worksheets[sheetName]; - } - - public IXLWorksheet GetWorksheet(int sheetIndex) - { - return worksheets.ElementAt(sheetIndex).Value; - } - - public IXLWorksheet Add(String sheetName) - { - var sheet = new XLWorksheet(sheetName); - worksheets.Add(sheetName, sheet); - return sheet; - } - - public void Delete(string sheetName) - { - worksheets.Remove(sheetName); - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - return worksheets.Values.GetEnumerator(); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - #endregion - - - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML/Extensions.cs b/ClosedXML/ClosedXML/ClosedXML/Extensions.cs deleted file mode 100644 index 70bb1fe..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Extensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; - -namespace ClosedXML -{ - public static class Extensions - { - // Adds the .ForEach method to all IEnumerables - public static void ForEach(this IEnumerable source, Action action) - { - foreach (T item in source) - action(item); - } - - static char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - public static String ToHex(this Color color) - { - - byte[] bytes = new byte[4]; - - bytes[0] = color.A; - - bytes[1] = color.R; - - bytes[2] = color.G; - - bytes[3] = color.B; - - char[] chars = new char[bytes.Length * 2]; - - for (int i = 0; i < bytes.Length; i++) - { - - int b = bytes[i]; - - chars[i * 2] = hexDigits[b >> 4]; - - chars[i * 2 + 1] = hexDigits[b & 0xF]; - - } - - return new string(chars); - - } - - public static String RemoveSpecialCharacters(this String str) - { - StringBuilder sb = new StringBuilder(); - foreach (char c in str) - { - //if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') | c == '.' || c == '_') - if (Char.IsLetterOrDigit(c)) - { - sb.Append(c); - } - } - return sb.ToString(); - } - - } -} - diff --git a/ClosedXML/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs deleted file mode 100644 index 367a544..0000000 --- a/ClosedXML/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("8747331d-de58-4621-8c7f-a7d57ca3467a")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/BasicTable.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/BasicTable.cs deleted file mode 100644 index 621bb45..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/BasicTable.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Examples -{ - public class BasicTable - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(); - var ws = workbook.Worksheets.Add("Contacts"); - - //First Names - ws.Cell("A1").Value = "FName"; - ws.Cell("A2").Value = "John"; - ws.Cell("A3").Value = "Hank"; - ws.Cell("A4").Value = "Dagny"; - //Last Names - ws.Cell("B1").Value = "LName"; - ws.Cell("B2").Value = "Galt"; - ws.Cell("B3").Value = "Rearden"; - ws.Cell("B4").Value = "Taggart"; - //Is an outcast? - ws.Cell("C1").Value = "Outcast"; - ws.Cell("C2").Value = true.ToString(); - ws.Cell("C3").Value = false.ToString(); - ws.Cell("C4").Value = false.ToString(); - //Date of Birth - ws.Cell("D1").Value = "DOB"; - ws.Cell("D2").Value = new DateTime(1919, 1, 21).ToString(); - ws.Cell("D3").Value = new DateTime(1907, 3, 4).ToString(); - ws.Cell("D4").Value = new DateTime(1921, 12, 15).ToString(); - //Income - ws.Cell("E1").Value = "Income"; - ws.Cell("E2").Value = "2000"; - ws.Cell("E3").Value = "40000"; - ws.Cell("E4").Value = "10000"; - - //var rngDates = ws.Range("D2:D4"); - //var rngNumbers = ws.Range("E2:E4"); - - //rngDates.Style.NumberFormat.Format = "mm-dd-yy"; - //rngNumbers.Style.NumberFormat.Format = "$ #,##0"; - - //var rngHeaders = ws.Range("A1:E1"); - //rngHeaders.Style.Font.Bold = true; - //rngHeaders.Style.Fill.BackgroundColor = "6BE8FF"; - - //var rngTable = ws.Range("A1:E4"); - //rngTable.Style.Border.BottomBorder = XLBorderStyleValues.Thin; - - workbook.SaveAs(filePath); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj b/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj deleted file mode 100644 index 4b4e9ba..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {03A518D0-1CB7-488E-861C-C4E782B27A46} - Exe - Properties - ClosedXML_Examples - ClosedXML_Examples - v4.0 - Client - 512 - SAK - SAK - SAK - SAK - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - ClosedXML - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc b/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/HelloWorld.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/HelloWorld.cs deleted file mode 100644 index 8f8c993..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/HelloWorld.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; - -namespace ClosedXML_Examples -{ - public class HelloWorld - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(); - var worksheet = workbook.Worksheets.Add("Sample Sheet"); - worksheet.Cell("A1").Value = "Hello World!"; - workbook.SaveAs(filePath); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Program.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Program.cs deleted file mode 100644 index 1b591ad..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML_Examples.Styles; - -namespace ClosedXML_Examples -{ - class Program - { - static void Main(string[] args) - { - //var helloWorld = new HelloWorld(); - //helloWorld.Create(@"c:\HelloWorld.xlsx"); - - //new StyleFont().Create(@"c:\styleFont.xlsx"); - - //new StyleFill().Create(@"c:\styleFill.xlsx"); - - new StyleBorder().Create(@"c:\styleBorder.xlsx"); - - //var basicTable = new BasicTable(); - //basicTable.Create(@"c:\BasicTable.xlsx"); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs deleted file mode 100644 index d492c06..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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_Examples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML_Examples")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("603cd89c-23f2-415e-8afc-2e9ab7a4c372")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleBorder.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleBorder.cs deleted file mode 100644 index 80ff9a7..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleBorder.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; -using ClosedXML.Excel; -using System.Drawing; - -namespace ClosedXML_Examples.Styles -{ - public class StyleBorder - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(); - var ws = workbook.Worksheets.Add("Style Border"); - - var co = 2; - var ro = 1; - - ws.Cell(++ro, co).Value = "BottomBorder = Thick; BottomBorderColor = Red"; - ws.Cell(ro, co).Style.Border.BottomBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.BottomBorderColor = Color.Red; - - ws.Cell(++ro, co).Value = "TopBorder = Thick; TopBorderColor = Red"; - ws.Cell(ro, co).Style.Border.TopBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.TopBorderColor = Color.Red; - - ws.Cell(++ro, co).Value = "LeftBorder = Thick; LeftBorderColor = Red"; - ws.Cell(ro, co).Style.Border.LeftBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.LeftBorderColor = Color.Red; - - ws.Cell(++ro, co).Value = "RightBorder = Thick; RightBorderColor = Red"; - ws.Cell(ro, co).Style.Border.RightBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.RightBorderColor = Color.Red; - - ws.Cell(++ro, co).Value = "DiagonalBorder = Thick; DiagonalBorderColor = Red; DiagonalUp = true"; - ws.Cell(ro, co).Style.Border.DiagonalBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.DiagonalBorderColor = Color.Red; - ws.Cell(ro, co).Style.Border.DiagonalUp = true; - - ws.Cell(++ro, co).Value = "DiagonalBorder = Thick; DiagonalBorderColor = Red; DiagonalDown = true"; - ws.Cell(ro, co).Style.Border.DiagonalBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.DiagonalBorderColor = Color.Red; - ws.Cell(ro, co).Style.Border.DiagonalDown = true; - - ws.Cell(++ro, co).Value = "DiagonalBorder = Thick; DiagonalBorderColor = Red; DiagonalUp = true; DiagonalDown = true"; - ws.Cell(ro, co).Style.Border.DiagonalBorder = XLBorderStyleValues.Thick; - ws.Cell(ro, co).Style.Border.DiagonalBorderColor = Color.Red; - ws.Cell(ro, co).Style.Border.DiagonalUp = true; - ws.Cell(ro, co).Style.Border.DiagonalDown = true; - - workbook.SaveAs(filePath); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFill.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFill.cs deleted file mode 100644 index d67188d..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFill.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using System.Drawing; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Examples.Styles -{ - public class StyleFill - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(); - var ws = workbook.Worksheets.Add("Style Fill"); - - var co = 2; - var ro = 1; - - ws.Cell(++ro, co).Value = "BackgroundColor = Red"; - ws.Cell(ro, co).Style.Fill.BackgroundColor = Color.Red; - - ws.Cell(++ro, co).Value = "PatternType = DarkTrellis; PatternColor = Red; PatternBackgroundColor = Blue"; - ws.Cell(ro, co).Style.Fill.PatternType = XLFillPatternValues.DarkTrellis; - ws.Cell(ro, co).Style.Fill.PatternColor = Color.Red; - ws.Cell(ro, co).Style.Fill.PatternBackgroundColor = Color.Blue; - - workbook.SaveAs(filePath); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFont.cs b/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFont.cs deleted file mode 100644 index 7e9ae00..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Examples/Styles/StyleFont.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using System.Drawing; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Examples.Styles -{ - public class StyleFont - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(); - var ws = workbook.Worksheets.Add("Style Font"); - - var co = 2; - var ro = 1; - - ws.Cell(++ro, co).Value = "Bold"; - ws.Cell(ro, co).Style.Font.Bold = true; - - ws.Cell(++ro, co).Value = "FontColor - Red"; - ws.Cell(ro, co).Style.Font.FontColor = Color.Red; - - ws.Cell(++ro, co).Value = "FontFamilyNumbering - Swiss"; - ws.Cell(ro, co).Style.Font.FontFamilyNumbering = XLFontFamilyNumberingValues.Swiss; - - ws.Cell(++ro, co).Value = "FontName - Arial"; - ws.Cell(ro, co).Style.Font.FontName = "Arial"; - - ws.Cell(++ro, co).Value = "FontSize = 8"; - ws.Cell(ro, co).Style.Font.FontSize = 8; - - ws.Cell(++ro, co).Value = "Italic"; - ws.Cell(ro, co).Style.Font.Italic = true; - - ws.Cell(++ro, co).Value = "Shadow"; - ws.Cell(ro, co).Style.Font.Shadow = true; - - ws.Cell(++ro, co).Value = "Strikethrough"; - ws.Cell(ro, co).Style.Font.Strikethrough = true; - - ws.Cell(++ro, co).Value = "Underline = Double"; - ws.Cell(ro, co).Style.Font.Underline = XLFontUnderlineValues.Double; - - ws.Cell(++ro, co).Value = "VerticalAlignment = Superscript"; - ws.Cell(ro, co).Style.Font.VerticalAlignment = XLFontVerticalTextAlignmentValues.Superscript; - - ws.Cell(++ro, co).Value = "Combined"; - ws.Cell(ro, co).Style.Font.Bold = true; - ws.Cell(ro, co).Style.Font.FontColor = Color.Red; - ws.Cell(ro, co).Style.Font.FontFamilyNumbering = XLFontFamilyNumberingValues.Swiss; - ws.Cell(ro, co).Style.Font.FontName = "Arial"; - ws.Cell(ro, co).Style.Font.FontSize = 8; - ws.Cell(ro, co).Style.Font.Italic = true; - ws.Cell(ro, co).Style.Font.Shadow = true; - ws.Cell(ro, co).Style.Font.Strikethrough = true; - ws.Cell(ro, co).Style.Font.Underline = XLFontUnderlineValues.Double; - ws.Cell(ro, co).Style.Font.VerticalAlignment = XLFontVerticalTextAlignmentValues.Superscript; - - - workbook.SaveAs(filePath); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj b/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj deleted file mode 100644 index ff83f9e..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB} - Exe - Properties - ClosedXML_Sandbox - ClosedXML_Sandbox - v4.0 - Client - 512 - SAK - SAK - SAK - SAK - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - ClosedXML - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc b/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs b/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs deleted file mode 100644 index 3c49e4e..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Sandbox -{ - class Program - { - static void Main(string[] args) - { - var wb = new XLWorkbook(); - var ws = wb.Worksheets.Add("New Sheet"); - ws.Cell(2, 2).Value = "Hello!"; - ws.Cell(2, 2).Style.Font.Bold = true; - wb.SaveAs(@"c:\Sandbox.xlsx"); - //Console.ReadKey(); - } - } -} diff --git a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs deleted file mode 100644 index 942db94..0000000 --- a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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_Sandbox")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML_Sandbox")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("7a3783fd-4e1b-4c17-a745-e6bbb593bd45")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs b/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs deleted file mode 100644 index 7701733..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public enum XLAlignmentReadingOrderValues - { - ContextDependent, - LeftToRight, - RightToLeft - } - - public enum XLAlignmentHorizontalValues - { - Center, - CenterContinuous, - Distributed, - Fill, - General, - Justify, - Left, - Right - } - - public enum XLAlignmentVerticalValues - { - Bottom, - Center, - Distributed, - Justify, - Top - } - - public class XLAlignment - { - #region Properties - - private XLRange range; - - private XLAlignmentHorizontalValues horizontal; - public XLAlignmentHorizontalValues Horizontal - { - get { return horizontal; } - set - { - Boolean updateIndent = !( - value == XLAlignmentHorizontalValues.Left - || value == XLAlignmentHorizontalValues.Right - || value == XLAlignmentHorizontalValues.Distributed - ); - - if (updateIndent) - indent = 0; - - horizontal = value; - - if (range != null) range.ProcessCells(c => - { - if (updateIndent) - c.CellStyle.Alignment.indent = 0; - - c.CellStyle.Alignment.horizontal = value; - }); - } - } - - private XLAlignmentVerticalValues vertical; - public XLAlignmentVerticalValues Vertical - { - get { return vertical; } - set - { - vertical = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.vertical = value); - } - } - - private UInt32 indent; - public UInt32 Indent - { - get - { - return indent; - } - set - { - if (value > 0 && !( - Horizontal == XLAlignmentHorizontalValues.Left - || Horizontal == XLAlignmentHorizontalValues.Right - || Horizontal == XLAlignmentHorizontalValues.Distributed - )) - { - throw new ArgumentException("For indents, only left, right, and distributed horizontal alignments are supported."); - } - indent = value; - - if (range != null) range.ProcessCells(c => - { - if (value > 0 && !( - c.CellStyle.Alignment.horizontal == XLAlignmentHorizontalValues.Left - || c.CellStyle.Alignment.horizontal == XLAlignmentHorizontalValues.Right - || c.CellStyle.Alignment.horizontal == XLAlignmentHorizontalValues.Distributed - )) - { - throw new ArgumentException("For indents, only left, right, and distributed horizontal alignments are supported. Change the horizontal alignment for all cells in the range."); - } - - c.CellStyle.Alignment.indent = value; - }); - } - } - - private Boolean justifyLastLine; - public Boolean JustifyLastLine - { - get { return justifyLastLine; } - set - { - justifyLastLine = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.justifyLastLine = value); - } - } - - private XLAlignmentReadingOrderValues readingOrder; - public XLAlignmentReadingOrderValues ReadingOrder - { - get { return readingOrder; } - set - { - readingOrder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.readingOrder = value); - } - } - - private Int32 relativeIndent; - public Int32 RelativeIndent - { - get { return relativeIndent; } - set - { - relativeIndent = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.relativeIndent = value); - } - } - - private Boolean shrinkToFit; - public Boolean ShrinkToFit - { - get { return shrinkToFit; } - set - { - shrinkToFit = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.shrinkToFit = value); - } - } - - private UInt32 textRotation; - public UInt32 TextRotation - { - get - { - return textRotation; - } - set - { - if (value > 180) - throw new ArgumentException("TextRotation degree cannot be greater than 180."); - else - { - textRotation = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.textRotation = value); - } - } - } - - private Boolean wrapText; - public Boolean WrapText - { - get { return wrapText; } - set - { - wrapText = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.wrapText = value); - } - } - - public Boolean TopToBottom - { - get - { - return textRotation == 255; - } - set - { - if (value) - { - textRotation = 255; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.textRotation = 255); - } - else - { - textRotation = 0; - if (range != null) range.ProcessCells(c => c.CellStyle.Alignment.textRotation = 0); - } - - } - } - - #endregion - - #region Constructors - - public XLAlignment(XLAlignment defaultAlignment, XLRange range) - { - this.range = range; - if (defaultAlignment != null) - { - horizontal = defaultAlignment.horizontal; - Vertical = defaultAlignment.Vertical; - indent = defaultAlignment.indent; - JustifyLastLine = defaultAlignment.JustifyLastLine; - ReadingOrder = defaultAlignment.ReadingOrder; - RelativeIndent = defaultAlignment.RelativeIndent; - ShrinkToFit = defaultAlignment.ShrinkToFit; - textRotation = defaultAlignment.textRotation; - WrapText = defaultAlignment.WrapText; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - return - Horizontal.ToString() - + "-" + Vertical.ToString() - + "-" + Indent.ToString() - + "-" + JustifyLastLine.ToString() - + "-" + ReadingOrder.ToString() - + "-" + RelativeIndent.ToString() - + "-" + ShrinkToFit.ToString() - + "-" + textRotation.ToString() - + "-" + WrapText.ToString() - ; - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs b/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs deleted file mode 100644 index eb785a4..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLBorder.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public enum XLBorderStyleValues - { - DashDot, - DashDotDot, - Dashed, - Dotted, - Double, - Hair, - Medium, - MediumDashDot, - MediumDashDotDot, - MediumDashed, - None, - SlantDashDot, - Thick, - Thin - } - - public class XLBorder - { - #region Properties - - private XLRange range; - - private XLBorderStyleValues leftBorder; - public XLBorderStyleValues LeftBorder - { - get { return leftBorder; } - set - { - leftBorder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.leftBorder = value); - } - } - - private String leftBorderColor; - public String LeftBorderColor - { - get { return leftBorderColor; } - set - { - leftBorderColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.leftBorderColor = value); - } - } - - private XLBorderStyleValues rightBorder; - public XLBorderStyleValues RightBorder - { - get { return rightBorder; } - set - { - rightBorder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.rightBorder = value); - } - } - - private String rightBorderColor; - public String RightBorderColor - { - get { return rightBorderColor; } - set - { - rightBorderColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.rightBorderColor = value); - } - } - - private XLBorderStyleValues topBorder; - public XLBorderStyleValues TopBorder - { - get { return topBorder; } - set - { - topBorder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.topBorder = value); - } - } - - private String topBorderColor; - public String TopBorderColor - { - get { return topBorderColor; } - set - { - topBorderColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.topBorderColor = value); - } - } - - private XLBorderStyleValues bottomBorder; - public XLBorderStyleValues BottomBorder - { - get { return bottomBorder; } - set - { - bottomBorder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.bottomBorder = value); - } - } - - private String bottomBorderColor; - public String BottomBorderColor - { - get { return bottomBorderColor; } - set - { - bottomBorderColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.bottomBorderColor = value); - } - } - - private Boolean diagonalUp; - public Boolean DiagonalUp - { - get { return diagonalUp; } - set - { - diagonalUp = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.diagonalUp = value); - } - } - - private Boolean diagonalDown; - public Boolean DiagonalDown - { - get { return diagonalDown; } - set - { - diagonalDown = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.diagonalDown = value); - } - } - - private XLBorderStyleValues diagonalBorder; - public XLBorderStyleValues DiagonalBorder - { - get { return diagonalBorder; } - set - { - diagonalBorder = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.diagonalBorder = value); - } - } - - private String diagonalBorderColor; - public String DiagonalBorderColor - { - get { return diagonalBorderColor; } - set - { - diagonalBorderColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Border.diagonalBorderColor = value); - } - } - - #endregion - - #region Constructors - - public XLBorder(XLBorder defaultBorder, XLRange range) - { - this.range = range; - if (defaultBorder != null) - { - LeftBorder = defaultBorder.LeftBorder; - LeftBorderColor = defaultBorder.LeftBorderColor; - RightBorder = defaultBorder.RightBorder; - RightBorderColor = defaultBorder.RightBorderColor; - TopBorder = defaultBorder.TopBorder; - TopBorderColor = defaultBorder.TopBorderColor; - BottomBorder = defaultBorder.BottomBorder; - BottomBorderColor = defaultBorder.BottomBorderColor; - DiagonalBorder = defaultBorder.DiagonalBorder; - DiagonalBorderColor = defaultBorder.DiagonalBorderColor; - DiagonalUp = defaultBorder.DiagonalUp; - DiagonalDown = defaultBorder.DiagonalDown; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - return - LeftBorder.ToString() + "-" + - LeftBorderColor.ToString() + "-" + - RightBorder.ToString() + "-" + - RightBorderColor.ToString() + "-" + - TopBorder.ToString() + "-" + - TopBorderColor.ToString() + "-" + - BottomBorder.ToString() + "-" + - BottomBorderColor.ToString() + "-" + - DiagonalBorder.ToString() + "-" + - DiagonalBorderColor.ToString() + "-" + - DiagonalUp.ToString() + "-" + - DiagonalDown.ToString(); - - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/Style/XLFill.cs b/ClosedXML/ClosedXML/Excel/Style/XLFill.cs deleted file mode 100644 index e35dc2f..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLFill.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public enum XLFillPatternValues - { - DarkDown, - DarkGray, - DarkGrid, - DarkHorizontal, - DarkTrellis, - DarkUp, - DarkVertical, - Gray0625, - Gray125, - LightDown, - LightGray, - LightGrid, - LightHorizontal, - LightTrellis, - LightUp, - LightVertical, - MediumGray, - None, - Solid - } - - public class XLFill - { - #region Properties - - private XLRange range; - - public String BackgroundColor - { - get - { - return patternColor; - } - set - { - patternType = XLFillPatternValues.Solid; - patternColor = value; - patternBackgroundColor = value; - if (range != null) range.ProcessCells(c => - { - c.CellStyle.Fill.patternType = XLFillPatternValues.Solid; - c.CellStyle.Fill.patternColor = value; - c.CellStyle.Fill.patternBackgroundColor = value; - }); - } - } - - - private String patternColor; - public String PatternColor - { - get - { - return patternColor; - } - set - { - this.patternColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Fill.patternColor = value); - } - } - - private String patternBackgroundColor; - public String PatternBackgroundColor - { - get - { - return patternBackgroundColor; - } - set - { - this.patternBackgroundColor = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Fill.patternBackgroundColor = value); - } - } - - private XLFillPatternValues patternType; - public XLFillPatternValues PatternType - { - get - { - return patternType; - } - set - { - this.patternType = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Fill.patternType = value); - } - } - - #endregion - - #region Constructors - - public XLFill(XLFill defaultFill, XLRange range) - { - this.range = range; - if (defaultFill != null) - { - PatternType = defaultFill.PatternType; - PatternColor = defaultFill.PatternColor; - PatternBackgroundColor = defaultFill.PatternBackgroundColor; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - return BackgroundColor.ToString() + "-" + PatternType.ToString() + "-" + PatternColor.ToString(); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/Style/XLFont.cs b/ClosedXML/ClosedXML/Excel/Style/XLFont.cs deleted file mode 100644 index 7b33f0d..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLFont.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public enum XLFontUnderlineValues - { - Double, - DoubleAccounting, - None, - Single, - SingleAccounting - } - - public enum XLFontVerticalTextAlignmentValues - { - Baseline, - Subscript, - Superscript - } - - public class XLFont - { - #region Properties - - private XLRange range; - - private Boolean bold; - public Boolean Bold - { - get - { - return bold; - } - set - { - this.bold = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.bold = value); - } - } - - private Boolean italic; - public Boolean Italic - { - get - { - return italic; - } - set - { - this.italic = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.italic = value); - } - } - - private XLFontUnderlineValues underline; - public XLFontUnderlineValues Underline - { - get - { - return underline; - } - set - { - this.underline = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.underline = value); - } - } - - private Boolean strikethrough; - public Boolean Strikethrough - { - get - { - return strikethrough; - } - set - { - this.strikethrough = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.strikethrough = value); - } - } - - private XLFontVerticalTextAlignmentValues verticalAlignment; - public XLFontVerticalTextAlignmentValues VerticalAlignment - { - get - { - return verticalAlignment; - } - set - { - this.verticalAlignment = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.verticalAlignment = value); - } - } - - private Boolean shadow; - public Boolean Shadow - { - get - { - return shadow; - } - set - { - this.shadow = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.shadow = value); - } - } - - private Double fontSize; - public Double FontSize - { - get - { - return fontSize; - } - set - { - this.fontSize = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.fontSize = value); - } - } - - private String color; - public String Color - { - get - { - return color; - } - set - { - this.color = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.color = value); - - } - } - - private String fontName; - public String FontName - { - get - { - return fontName; - } - set - { - this.fontName = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.fontName = value); - } - } - - private Int32 fontFamilyNumbering; - public Int32 FontFamilyNumbering - { - get - { - return fontFamilyNumbering; - } - set - { - this.fontFamilyNumbering = value; - if (range != null) range.ProcessCells(c => c.CellStyle.Font.fontFamilyNumbering = value); - } - } - - #endregion - - #region Constructors - - public XLFont(XLFont defaultFont, XLRange range) - { - this.range = range; - if (defaultFont != null) - { - Bold = defaultFont.Bold; - Italic = defaultFont.Italic; - Underline = defaultFont.Underline; - Strikethrough = defaultFont.Strikethrough; - VerticalAlignment = defaultFont.VerticalAlignment; - Shadow = defaultFont.Shadow; - FontFamilyNumbering = defaultFont.FontFamilyNumbering; - FontName = defaultFont.FontName; - FontSize = defaultFont.FontSize; - Color = defaultFont.Color; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append(Bold.ToString()); - sb.Append("-"); - sb.Append(FontSize.ToString()); - sb.Append("-"); - sb.Append(Color); - sb.Append("-"); - sb.Append(FontName); - sb.Append("-"); - sb.Append(FontFamilyNumbering.ToString()); - return sb.ToString(); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs b/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs deleted file mode 100644 index bd61b3d..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLNumberFormat.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel.Style -{ - public class XLNumberFormat - { - #region Properties - - private XLRange range; - - private UInt32? numberFormatId; - public UInt32? NumberFormatId - { - get { return numberFormatId; } - set - { - numberFormatId = value; - format = String.Empty; - if (range != null) range.ProcessCells(c => - { - c.CellStyle.NumberFormat.numberFormatId = value; - c.CellStyle.NumberFormat.format = String.Empty; - }); - } - } - - private String format = String.Empty; - public String Format - { - get { return format; } - set - { - format = value; - numberFormatId = null; - if (range != null) range.ProcessCells(c => - { - c.CellStyle.NumberFormat.numberFormatId = null; - c.CellStyle.NumberFormat.format = value; - }); - } - } - - #endregion - - #region Constructors - - public XLNumberFormat(XLNumberFormat numberFormat, XLRange range) - { - this.range = range; - if (numberFormat != null) - { - if (numberFormat.numberFormatId.HasValue) - NumberFormatId = numberFormat.NumberFormatId.Value; - else - Format = numberFormat.Format; - } - } - - #endregion - - #region Overridden - - public override string ToString() - { - String numberFormatIdString = numberFormatId.HasValue ? numberFormatId.Value.ToString() : "n/a"; - return numberFormatIdString + "-" + format.ToString(); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs b/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs deleted file mode 100644 index 162b6c2..0000000 --- a/ClosedXML/ClosedXML/Excel/Style/XLStyle.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using DocumentFormat.OpenXml.Spreadsheet; - -namespace ClosedXML.Excel.Style -{ - public class XLStyle - { - XLRange range; - public XLStyle(XLStyle initialStyle, XLRange range) - { - this.range = range; - if (initialStyle != null) - { - Font = new XLFont(initialStyle.Font, range); - Fill = new XLFill(initialStyle.Fill, range); - Border = new XLBorder(initialStyle.Border, range); - NumberFormat = new XLNumberFormat(initialStyle.NumberFormat, range); - Alignment = new XLAlignment(initialStyle.Alignment, range); - } - else - { - Font = new XLFont(null, range); - Fill = new XLFill(null, range); - Border = new XLBorder(null, range); - NumberFormat = new XLNumberFormat(null, range); - Alignment = new XLAlignment(null, range); - } - } - - public XLFont Font { get; set; } - public XLFill Fill { get; set; } - public XLBorder Border { get; set; } - public XLNumberFormat NumberFormat { get; set; } - public XLAlignment Alignment { get; set; } - - public override string ToString() - { - return - "Font:" + Font.ToString() - + " Fill:" + Fill.ToString() - + " Border:" + Border.ToString() - + " NumberFormat: " + NumberFormat.ToString() - + " Alignment: " + Alignment.ToString(); - } - - } -} \ No newline at end of file diff --git a/ClosedXML/ClosedXML/Excel/XLAddress.cs b/ClosedXML/ClosedXML/Excel/XLAddress.cs deleted file mode 100644 index f5f1243..0000000 --- a/ClosedXML/ClosedXML/Excel/XLAddress.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; - -namespace ClosedXML.Excel -{ - /// - /// Represents the address of a single cell in a worksheet. - /// - public struct XLAddress : IEqualityComparer, IEquatable, IComparable, IComparable - { - #region Constructors - - /// - /// Initializes a new struct using R1C1 notation. - /// - /// The row number of the cell address. - /// The column number of the cell address. - public XLAddress(UInt32 row, UInt32 column) - { - this.row = row; - this.column = column; - this.columnLetter = GetColumnLetterFromNumber(column); - } - - /// - /// Initializes a new struct using a mixed notation. - /// - /// The row number of the cell address. - /// The column letter of the cell address. - public XLAddress(UInt32 row, String columnLetter) - { - this.row = row; - this.column = GetColumnNumberFromLetter(columnLetter); - this.columnLetter = columnLetter; - } - - - /// - /// Initializes a new struct using A1 notation. - /// - /// The cell address. - public XLAddress(String cellAddressString) - { - Match m = Regex.Match(cellAddressString, @"^([a-zA-Z]+)(\d+)$"); - columnLetter = m.Groups[1].Value; - this.row = UInt32.Parse(m.Groups[2].Value); - this.column = GetColumnNumberFromLetter(columnLetter); - } - - #endregion - - #region Properties - - private UInt32 row; - /// - /// Gets the row number of this address. - /// - public UInt32 Row - { - get { return row; } - private set { row = value; } - } - - private UInt32 column; - /// - /// Gets the column number of this address. - /// - public UInt32 Column - { - get { return column; } - private set { column = value; } - } - - private String columnLetter; - /// - /// Gets the column letter(s) of this address. - /// - public String ColumnLetter - { - get { return columnLetter; } - private set { columnLetter = value; } - } - - #endregion - - #region Static - - /// - /// Gets the column number of a given column letter. - /// - /// The column letter to translate into a column number. - public static UInt32 GetColumnNumberFromLetter(String column) - { - Int32 intColumnLetterLength = column.Length; - Int32 retVal = 0; - for (Int32 intCount = 0; intCount < intColumnLetterLength; intCount++) - { - retVal = retVal * 26 + (column.Substring(intCount, 1).ToUpper().ToCharArray()[0] - 64); - } - return (UInt32)retVal; - } - - /// - /// Gets the column letter of a given column number. - /// - /// The column number to translate into a column letter. - public static String GetColumnLetterFromNumber(UInt32 column) - { - String s = String.Empty; - for ( - Int32 i = Convert.ToInt32( - Math.Log( - Convert.ToDouble( - 25 * ( - Convert.ToDouble(column) - + 1 - ) - ) - ) / Math.Log(26) - ) - 1 - ; i >= 0 - ; i-- - ) - { - Int32 x = Convert.ToInt32(Math.Pow(26, i + 1) - 1) / 25 - 1; - if (column > x) - { - s += (Char)(((column - x - 1) / Convert.ToInt32(Math.Pow(26, i))) % 26 + 65); - } - } - return s; - } - - #endregion - - #region Overridden - - public override String ToString() - { - return ColumnLetter + Row.ToString(); - } - - #endregion - - #region Operator Overloads - - public static XLAddress operator +(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return new XLAddress(xlCellAddressLeft.Row + xlCellAddressRight.Row, xlCellAddressLeft.Column + xlCellAddressRight.Column); - } - - public static XLAddress operator -(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return new XLAddress(xlCellAddressLeft.Row - xlCellAddressRight.Row, xlCellAddressLeft.Column - xlCellAddressRight.Column); - } - - public static XLAddress operator +(XLAddress xlCellAddressLeft, UInt32 right) - { - return new XLAddress(xlCellAddressLeft.Row + right, xlCellAddressLeft.Column + right); - } - - public static XLAddress operator -(XLAddress xlCellAddressLeft, UInt32 right) - { - return new XLAddress(xlCellAddressLeft.Row - right, xlCellAddressLeft.Column - right); - } - - public static Boolean operator ==(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return - xlCellAddressLeft.Row == xlCellAddressRight.Row - && xlCellAddressLeft.Column == xlCellAddressRight.Column; - } - - public static Boolean operator !=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight); - } - - public static Boolean operator >(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight) - && (xlCellAddressLeft.Row > xlCellAddressRight.Row || xlCellAddressLeft.Column > xlCellAddressRight.Column); - } - - public static Boolean operator <(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return !(xlCellAddressLeft == xlCellAddressRight) - && (xlCellAddressLeft.Row < xlCellAddressRight.Row || xlCellAddressLeft.Column < xlCellAddressRight.Column); - } - - public static Boolean operator >=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return xlCellAddressLeft == xlCellAddressRight || xlCellAddressLeft > xlCellAddressRight; - } - - public static Boolean operator <=(XLAddress xlCellAddressLeft, XLAddress xlCellAddressRight) - { - return xlCellAddressLeft == xlCellAddressRight || xlCellAddressLeft < xlCellAddressRight; - } - - #endregion - - #region Interface Requirements - - #region IEqualityComparer Members - - public Boolean Equals(XLAddress x, XLAddress y) - { - return x == y; - } - - public Int32 GetHashCode(XLAddress obj) - { - return obj.GetHashCode(); - } - - new public Boolean Equals(Object x, Object y) - { - return x == y; - } - - public Int32 GetHashCode(Object obj) - { - return obj.GetHashCode(); - } - - public override Int32 GetHashCode() - { - return this.ToString().GetHashCode(); - } - - #endregion - - #region IEquatable Members - - public Boolean Equals(XLAddress other) - { - return this == other; - } - - public override Boolean Equals(Object other) - { - return this == (XLAddress)other; - } - - #endregion - - #region IComparable Members - - public Int32 CompareTo(object obj) - { - var other = (XLAddress)obj; - if (this == other) - return 0; - else if (this > other) - return 1; - else - return -1; - } - - #endregion - - #region IComparable Members - - public int CompareTo(XLAddress other) - { - throw new NotImplementedException(); - } - - #endregion - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Excel/XLRange.cs b/ClosedXML/ClosedXML/Excel/XLRange.cs deleted file mode 100644 index 321ffc0..0000000 --- a/ClosedXML/ClosedXML/Excel/XLRange.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - public enum XLCellValues { SharedString, Number, Boolean, DateTime } - - public class XLRange - { - private Dictionary worksheetCells; - public Boolean IsWorksheet { get; private set; } - public Boolean IsCell { get; private set; } - private XLRange Worksheet { get; set; } - public XLRange ParentRange { get; private set; } - private String worksheetName; - public String Name { get { return ToString(); } } - private Boolean isInitializing; - private XLWorkbook workbook; - public XLRange(XLAddress firstCellAddress, XLAddress lastCellAddress, XLRange parentRange, XLRange worksheet, String name = "", XLWorkbook workbook=null) - { - isInitializing = true; - this.worksheetName = name; - this.workbook = workbook; - FirstCellAddress = firstCellAddress; - LastCellAddress = lastCellAddress; - IsCell = firstCellAddress == lastCellAddress; - - ParentRange = parentRange; - if (worksheet != null) - { - IsWorksheet = false; - Worksheet = worksheet; - CellStyle = new XLStyle(parentRange.CellStyle, this); - } - else - { - IsWorksheet = true; - worksheetCells = new Dictionary(); - Worksheet = this; - var defaultStyle = new XLStyle(workbook.WorkbookStyle, this); - - CellStyle = defaultStyle; - } - isInitializing = false; - } - - public XLAddress Address { get { return FirstCellAddress; } } - - private XLAddress FirstCellAddress { get; set; } - public XLRange FirstCell - { - get - { - return Cell(FirstCellAddress); - } - } - - private XLAddress LastCellAddress { get; set; } - public XLRange LastCell - { - get - { - return Cell(LastCellAddress); - } - } - - public XLAddress AddressInWorksheet { get { return FirstCellAddressInWorksheet; } } - - private XLAddress FirstCellAddressInWorksheet - { - get - { - if (IsWorksheet || ParentRange.IsWorksheet) - return FirstCellAddress; - else - return FirstCellAddress + ParentRange.FirstCellAddressInWorksheet - 1; - } - } - - private XLAddress LastCellAddressAbsolute - { - get - { - if (IsWorksheet || ParentRange.IsWorksheet) - return LastCellAddress; - else - return ParentRange.FirstCellAddressInWorksheet + LastCellAddress - 1; - } - } - - public XLRange Range(XLAddress firstCellAddress, XLAddress lastCellAddress) - { - if (lastCellAddress > (LastCellAddress - FirstCellAddress + 1)) - throw new IndexOutOfRangeException("Cell addresses must be within parent range."); - - return new XLRange(firstCellAddress, lastCellAddress, this, Worksheet); - } - - public XLRange Range(String firstCellAddress, String lastCellAddress) - { - return Range(new XLAddress(firstCellAddress), new XLAddress(lastCellAddress)); - } - - public XLRange Range(String rangeAddress) - { - String[] arrRange = rangeAddress.Split(':'); - return Range(arrRange[0], arrRange[1]); - } - - public XLRange Cell(XLAddress address) - { - XLAddress absoluteCellAddress; - if (IsWorksheet || ParentRange.IsWorksheet) - absoluteCellAddress = address; - else - absoluteCellAddress = ParentRange.FirstCellAddressInWorksheet + address - 1; - - var cell = Worksheet.GetCell(absoluteCellAddress); - return cell; - } - - public XLRange Cell(String addressString) - { - var cellAddress = new XLAddress(addressString); - return Cell(cellAddress); - } - - public XLRange Cell(UInt32 row, UInt32 column) - { - var cellAddress = new XLAddress(row, column); - return Cell(cellAddress); - } - - protected XLRange GetCell(XLAddress cellAddress) - { - if (!worksheetCells.ContainsKey(cellAddress)) - { - worksheetCells.Add(cellAddress, new XLRange(cellAddress, cellAddress, this, this)); - } - - return worksheetCells[cellAddress]; - } - - public Boolean HasValue { get; private set; } - - public XLCellValues DataType { get; set; } - - private String cellValue; - public String Value - { - get - { - return Worksheet.GetCell(FirstCellAddressInWorksheet).cellValue; - } - set - { - String val = value; - - Double dTest; - DateTime dtTest; - Boolean bTest; - if (Double.TryParse(val, out dTest)) - { - DataType = XLCellValues.Number; - } - else if (DateTime.TryParse(val, out dtTest)) - { - DataType = XLCellValues.DateTime; - String dateSerial = GetSerialFromDateTime(dtTest).ToString(); - Style.NumberFormat.NumberFormatId = 14; - val = dateSerial; - } - else if (Boolean.TryParse(val, out bTest)) - { - DataType = XLCellValues.Boolean; - val = bTest ? "1" : "0"; - } - else - { - DataType = XLCellValues.SharedString; - } - - Worksheet.GetCell(FirstCellAddressInWorksheet).cellValue = val; - Worksheet.GetCell(FirstCellAddressInWorksheet).HasValue = !val.Equals(String.Empty); - } - } - - - internal XLStyle CellStyle; - public XLStyle Style - { - get - { - if(CellStyle == null) - CellStyle = new XLStyle(Worksheet.GetCell(FirstCellAddressInWorksheet).CellStyle, this); - - return CellStyle; - } - set - { - Cells().ForEach(c => c.CellStyle = new XLStyle(value, this)); - } - } - - public IEnumerable Cells() - { - if (IsWorksheet) - { - foreach (var cell in worksheetCells.Where(c=>c.Key != LastCellAddress).Select(c=>c.Value)) - { - yield return cell; - } - } - else - { - for (UInt32 row = FirstCellAddressInWorksheet.Row; row <= LastCellAddressAbsolute.Row; row++) - { - for (UInt32 column = FirstCellAddressInWorksheet.Column; column <= LastCellAddressAbsolute.Column; column++) - { - yield return Worksheet.GetCell(new XLAddress(row, column)); - } - } - } - } - - private DateTime GetDateTimeFromSerial(Double serialDate) - { - String sDate = serialDate.ToString(); - Int32 datePart = Int32.Parse(sDate.Split('.').First()); - Double timePart = serialDate - (Double)datePart; - if (datePart > 59) datePart -= 1; //Excel/Lotus 2/29/1900 bug - - TimeSpan maxTime = new TimeSpan(0, 23, 59, 59, 999); - Double totalMilliseconds = maxTime.TotalMilliseconds * timePart; - - return new DateTime(1899, 12, 31).AddDays(datePart).AddMilliseconds(totalMilliseconds); - } - - private Double GetSerialFromDateTime(DateTime dateTime) - { - Int32 nDay = dateTime.Day; - Int32 nMonth = dateTime.Month; - Int32 nYear = dateTime.Year; - - // Excel/Lotus 123 have a bug with 29-02-1900. 1900 is not a - // leap year, but Excel/Lotus 123 think it is... - if (nDay == 29 && nMonth == 02 && nYear == 1900) - return 60; - - // DMY to Modified Julian calculatie with an extra substraction of 2415019. - long nSerialDate = - (int)((1461 * (nYear + 4800 + (int)((nMonth - 14) / 12))) / 4) + - (int)((367 * (nMonth - 2 - 12 * ((nMonth - 14) / 12))) / 12) - - (int)((3 * ((int)((nYear + 4900 + (int)((nMonth - 14) / 12)) / 100))) / 4) + - nDay - 2415019 - 32075; - - if (nSerialDate < 60) - { - // Because of the 29-02-1900 bug, any serial date - // under 60 is one off... Compensate. - nSerialDate--; - } - - TimeSpan timePart = new TimeSpan(dateTime.Hour, dateTime.Minute, dateTime.Second); - TimeSpan maxTime = new TimeSpan(0, 23, 59, 59, 999); - Double timeRatio = timePart.TotalMilliseconds / maxTime.TotalMilliseconds; - - return (Double)nSerialDate + timeRatio; - } - - - - internal void ProcessCells(Action action) - { - if (!(IsWorksheet || isInitializing)) //(IsCell && ParentRange.IsWorksheet))) - { - Cells().ForEach(c => action(c)); - } - } - - #region Overridden - - public override string ToString() - { - if (IsWorksheet) - return worksheetName; - else - return FirstCellAddress.ToString(); - } - - #endregion - - } -} diff --git a/ClosedXML/ClosedXML/Excel/XLWorkbook.cs b/ClosedXML/ClosedXML/Excel/XLWorkbook.cs deleted file mode 100644 index b9d83e9..0000000 --- a/ClosedXML/ClosedXML/Excel/XLWorkbook.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using ClosedXML.Excel.Style; - -namespace ClosedXML.Excel -{ - /// - /// Represents an Excel Workbook file - /// - public partial class XLWorkbook - { - #region Properties - - /// - /// Gets an instance of the class. - /// It allows you to add, access, and remove worksheets from the workbook. - /// - public XLWorksheets Worksheets { get; private set; } - - /// - /// Gets the file name of the workbook. - /// - public String Name { get; private set; } - - /// - /// Gets the file name of the workbook including its full directory. - /// - public String FullName { get; private set; } - - /// - /// Gets the default style for new cells in this workbook. - /// - public XLStyle WorkbookStyle { get; private set; } - - #endregion - - #region Static - - private static XLStyle defaultStyle; - /// - /// Gets the default style for new workbooks. - /// - public static XLStyle DefaultStyle - { - get - { - if (defaultStyle == null) - { - defaultStyle = new XLStyle(null, null) - { - Font = new XLFont(null, null) - { - Bold = false, - Italic = false, - Underline = XLFontUnderlineValues.None, - Strikethrough = false, - VerticalAlignment = XLFontVerticalTextAlignmentValues.Baseline, - FontSize = 11, - Color = "FF000000", - FontName = "Calibri", - FontFamilyNumbering = 2 - }, - Fill = new XLFill(null, null) - { - BackgroundColor = "FFFFFFFF", - PatternType = XLFillPatternValues.None - }, - Border = new XLBorder(null, null) - { - BottomBorder = XLBorderStyleValues.None, - DiagonalBorder = XLBorderStyleValues.None, - DiagonalDown = false, - DiagonalUp = false, - LeftBorder = XLBorderStyleValues.None, - RightBorder = XLBorderStyleValues.None, - TopBorder = XLBorderStyleValues.None, - BottomBorderColor = "000000", - DiagonalBorderColor = "000000", - LeftBorderColor = "000000", - RightBorderColor = "000000", - TopBorderColor = "000000" - }, - NumberFormat = new XLNumberFormat(null, null), - Alignment = new XLAlignment(null, null) - { - Horizontal = XLAlignmentHorizontalValues.General, - Indent = 0, - JustifyLastLine = false, - ReadingOrder = XLAlignmentReadingOrderValues.ContextDependent, - RelativeIndent = 0, - ShrinkToFit = false, - TextRotation = 0, - Vertical = XLAlignmentVerticalValues.Bottom, - WrapText = false - } - }; - } - return defaultStyle; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// New Excel file to be created. - public XLWorkbook(String file) - { - if (File.Exists(file)) File.Delete(file); - //throw new ArgumentException("File already exists."); - - FileInfo fi = new FileInfo(file); - this.Name = fi.Name; - this.FullName = fi.FullName; - Worksheets = new XLWorksheets(this); - - WorkbookStyle = new XLStyle(XLWorkbook.DefaultStyle, null); - } - - #endregion - - #region Methods - - /// - /// Saves the current workbook to disk. - /// - public void Save() - { - // For maintainability reasons the XLWorkbook class was divided into two files. - // The method CreatePackage can be located in the file XLWorkbook_Save.cs - CreatePackage(this.FullName); - } - - #endregion - - } -} diff --git a/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs deleted file mode 100644 index 92e615c..0000000 --- a/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs +++ /dev/null @@ -1,1230 +0,0 @@ -using DocumentFormat.OpenXml.Packaging; -using Ap = DocumentFormat.OpenXml.ExtendedProperties; -using Vt = DocumentFormat.OpenXml.VariantTypes; -using DocumentFormat.OpenXml; -using DocumentFormat.OpenXml.Spreadsheet; -using A = DocumentFormat.OpenXml.Drawing; -using Xdr = DocumentFormat.OpenXml.Drawing.Spreadsheet; -using C = DocumentFormat.OpenXml.Drawing.Charts; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using ClosedXML.Excel.Style; - - -namespace ClosedXML.Excel -{ - public partial class XLWorkbook - { - - private Dictionary sharedStrings = new Dictionary(); - private struct FontInfo { public UInt32 FontId; public XLFont Font; }; - private struct FillInfo { public UInt32 FillId; public XLFill Fill; }; - private struct BorderInfo { public UInt32 BorderId; public XLBorder Border; }; - private struct NumberFormatInfo { public UInt32 NumberFormatId; public XLNumberFormat NumberFormat; }; - - - private struct StyleInfo - { - public UInt32 StyleId; - public UInt32 FontId; - public UInt32 FillId; - public UInt32 BorderId; - public UInt32 NumberFormatId; - public XLStyle Style; - }; - - private Dictionary sharedStyles = new Dictionary(); - - private CellValues GetCellValue(XLCellValues xlCellValue) - { - switch (xlCellValue) - { - case XLCellValues.Boolean: return CellValues.Boolean; - case XLCellValues.DateTime: return CellValues.Date; - case XLCellValues.Number: return CellValues.Number; - case XLCellValues.SharedString: return CellValues.SharedString; - default: throw new NotImplementedException(); - } - } - - private UnderlineValues GetUnderlineValue(XLFontUnderlineValues xlFontUnderlineValue) - { - switch (xlFontUnderlineValue) - { - case XLFontUnderlineValues.Double: return UnderlineValues.Double; - case XLFontUnderlineValues.DoubleAccounting: return UnderlineValues.DoubleAccounting; - case XLFontUnderlineValues.None: return UnderlineValues.None; - case XLFontUnderlineValues.Single: return UnderlineValues.Single; - case XLFontUnderlineValues.SingleAccounting: return UnderlineValues.SingleAccounting; - default: throw new NotImplementedException(); - } - } - - private VerticalAlignmentRunValues GetVerticalAlignmentRunValue(XLFontVerticalTextAlignmentValues xlFontVerticalTextAlignmentValue) - { - switch (xlFontVerticalTextAlignmentValue) - { - case XLFontVerticalTextAlignmentValues.Baseline: return VerticalAlignmentRunValues.Baseline; - case XLFontVerticalTextAlignmentValues.Subscript: return VerticalAlignmentRunValues.Subscript; - case XLFontVerticalTextAlignmentValues.Superscript: return VerticalAlignmentRunValues.Superscript; - default: throw new NotImplementedException(); - } - } - - private PatternValues GetPatternValue(XLFillPatternValues xlFillPatternValue) - { - switch (xlFillPatternValue) - { - case XLFillPatternValues.DarkDown: return PatternValues.DarkDown; - case XLFillPatternValues.DarkGray: return PatternValues.DarkGray; - case XLFillPatternValues.DarkGrid: return PatternValues.DarkGrid; - case XLFillPatternValues.DarkHorizontal: return PatternValues.DarkHorizontal; - case XLFillPatternValues.DarkTrellis: return PatternValues.DarkTrellis; - case XLFillPatternValues.DarkUp: return PatternValues.DarkUp; - case XLFillPatternValues.DarkVertical: return PatternValues.DarkVertical; - case XLFillPatternValues.Gray0625: return PatternValues.Gray0625; - case XLFillPatternValues.Gray125: return PatternValues.Gray125; - case XLFillPatternValues.LightDown: return PatternValues.LightDown; - case XLFillPatternValues.LightGray: return PatternValues.LightGray; - case XLFillPatternValues.LightGrid: return PatternValues.LightGrid; - case XLFillPatternValues.LightHorizontal: return PatternValues.LightHorizontal; - case XLFillPatternValues.LightTrellis: return PatternValues.LightTrellis; - case XLFillPatternValues.LightUp: return PatternValues.LightUp; - case XLFillPatternValues.LightVertical: return PatternValues.LightVertical; - case XLFillPatternValues.MediumGray: return PatternValues.MediumGray; - case XLFillPatternValues.None: return PatternValues.None; - case XLFillPatternValues.Solid: return PatternValues.Solid; - default: throw new NotImplementedException(); - } - } - - private BorderStyleValues GetBorderStyleValue(XLBorderStyleValues xlBorderStyleValue) - { - switch (xlBorderStyleValue) - { - case XLBorderStyleValues.DashDot: return BorderStyleValues.DashDot; - case XLBorderStyleValues.DashDotDot: return BorderStyleValues.DashDotDot; - case XLBorderStyleValues.Dashed: return BorderStyleValues.Dashed; - case XLBorderStyleValues.Dotted: return BorderStyleValues.Dotted; - case XLBorderStyleValues.Double: return BorderStyleValues.Double; - case XLBorderStyleValues.Hair: return BorderStyleValues.Hair; - case XLBorderStyleValues.Medium: return BorderStyleValues.Medium; - case XLBorderStyleValues.MediumDashDot: return BorderStyleValues.MediumDashDot; - case XLBorderStyleValues.MediumDashDotDot: return BorderStyleValues.MediumDashDotDot; - case XLBorderStyleValues.MediumDashed: return BorderStyleValues.MediumDashed; - case XLBorderStyleValues.None: return BorderStyleValues.None; - case XLBorderStyleValues.SlantDashDot: return BorderStyleValues.SlantDashDot; - case XLBorderStyleValues.Thick: return BorderStyleValues.Thick; - case XLBorderStyleValues.Thin: return BorderStyleValues.Thin; - default: throw new NotImplementedException(); - } - } - - private HorizontalAlignmentValues GetHorizontalAlignmentValue(XLAlignmentHorizontalValues xlAlignmentHorizontalValue) - { - switch (xlAlignmentHorizontalValue) - { - case XLAlignmentHorizontalValues.Center: return HorizontalAlignmentValues.Center; - case XLAlignmentHorizontalValues.CenterContinuous: return HorizontalAlignmentValues.CenterContinuous; - case XLAlignmentHorizontalValues.Distributed: return HorizontalAlignmentValues.Distributed; - case XLAlignmentHorizontalValues.Fill: return HorizontalAlignmentValues.Fill; - case XLAlignmentHorizontalValues.General: return HorizontalAlignmentValues.General; - case XLAlignmentHorizontalValues.Justify: return HorizontalAlignmentValues.Justify; - case XLAlignmentHorizontalValues.Left: return HorizontalAlignmentValues.Left; - case XLAlignmentHorizontalValues.Right: return HorizontalAlignmentValues.Right; - default: throw new NotImplementedException(); - } - } - - private VerticalAlignmentValues GetVerticalAlignmentValue(XLAlignmentVerticalValues xlAlignmentVerticalValue) - { - switch (xlAlignmentVerticalValue) - { - case XLAlignmentVerticalValues.Bottom: return VerticalAlignmentValues.Bottom; - case XLAlignmentVerticalValues.Center: return VerticalAlignmentValues.Center; - case XLAlignmentVerticalValues.Distributed: return VerticalAlignmentValues.Distributed; - case XLAlignmentVerticalValues.Justify: return VerticalAlignmentValues.Justify; - case XLAlignmentVerticalValues.Top: return VerticalAlignmentValues.Top; - default: throw new NotImplementedException(); - } - } - - // Creates a SpreadsheetDocument. - private void CreatePackage(String filePath) - { - using (SpreadsheetDocument package = SpreadsheetDocument.Create(filePath, SpreadsheetDocumentType.Workbook)) - { - CreateParts(package); - } - } - - // Adds child parts and generates content of the specified part. - private void CreateParts(SpreadsheetDocument document) - { - ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart("rId3"); - GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1); - - WorkbookPart workbookPart = document.AddWorkbookPart(); - GenerateWorkbookPartContent(workbookPart); - - SharedStringTablePart sharedStringTablePart = workbookPart.AddNewPart("rId6"); - GenerateSharedStringTablePartContent(sharedStringTablePart); - - WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart("rId5"); - GenerateWorkbookStylesPartContent(workbookStylesPart); - - UInt32 sheetId = 0; - foreach (var xlWorksheet in this.Worksheets) - { - sheetId++; - WorksheetPart worksheetPart = workbookPart.AddNewPart("rId" + sheetId.ToString()); - GenerateWorksheetPartContent(worksheetPart, xlWorksheet); - - } - - ThemePart themePart1 = workbookPart.AddNewPart("rId4"); - GenerateThemePart1Content(themePart1); - - SetPackageProperties(document); - } - - // Generates content of extendedFilePropertiesPart1. - private void GenerateExtendedFilePropertiesPart1Content(ExtendedFilePropertiesPart extendedFilePropertiesPart1) - { - Ap.Properties properties1 = new Ap.Properties(); - properties1.AddNamespaceDeclaration("vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"); - Ap.Application application1 = new Ap.Application(); - application1.Text = "Microsoft Excel"; - Ap.DocumentSecurity documentSecurity1 = new Ap.DocumentSecurity(); - documentSecurity1.Text = "0"; - Ap.ScaleCrop scaleCrop1 = new Ap.ScaleCrop(); - scaleCrop1.Text = "false"; - - Ap.HeadingPairs headingPairs1 = new Ap.HeadingPairs(); - - Vt.VTVector vTVector1 = new Vt.VTVector() { BaseType = Vt.VectorBaseValues.Variant, Size = (UInt32Value)2U }; - - Vt.Variant variant1 = new Vt.Variant(); - Vt.VTLPSTR vTLPSTR1 = new Vt.VTLPSTR(); - vTLPSTR1.Text = "Worksheets"; - - variant1.Append(vTLPSTR1); - - Vt.Variant variant2 = new Vt.Variant(); - Vt.VTInt32 vTInt321 = new Vt.VTInt32(); - vTInt321.Text = "3"; - - variant2.Append(vTInt321); - - vTVector1.Append(variant1); - vTVector1.Append(variant2); - - headingPairs1.Append(vTVector1); - - Ap.TitlesOfParts titlesOfParts1 = new Ap.TitlesOfParts(); - - UInt32 sheetCount = (UInt32)this.Worksheets.Count; - Vt.VTVector vTVector2 = new Vt.VTVector() { BaseType = Vt.VectorBaseValues.Lpstr, Size = (UInt32Value)sheetCount }; - foreach (var xlWorksheet in this.Worksheets) - { - Vt.VTLPSTR vTLPSTR2 = new Vt.VTLPSTR(); - vTLPSTR2.Text = xlWorksheet.Name; - vTVector2.Append(vTLPSTR2); - } - - titlesOfParts1.Append(vTVector2); - Ap.Company company1 = new Ap.Company(); - company1.Text = ""; - Ap.LinksUpToDate linksUpToDate1 = new Ap.LinksUpToDate(); - linksUpToDate1.Text = "false"; - Ap.SharedDocument sharedDocument1 = new Ap.SharedDocument(); - sharedDocument1.Text = "false"; - Ap.HyperlinksChanged hyperlinksChanged1 = new Ap.HyperlinksChanged(); - hyperlinksChanged1.Text = "false"; - Ap.ApplicationVersion applicationVersion1 = new Ap.ApplicationVersion(); - applicationVersion1.Text = "12.0000"; - - properties1.Append(application1); - properties1.Append(documentSecurity1); - properties1.Append(scaleCrop1); - properties1.Append(headingPairs1); - properties1.Append(titlesOfParts1); - properties1.Append(company1); - properties1.Append(linksUpToDate1); - properties1.Append(sharedDocument1); - properties1.Append(hyperlinksChanged1); - properties1.Append(applicationVersion1); - - extendedFilePropertiesPart1.Properties = properties1; - } - - // Generates content of workbookPart1. - private void GenerateWorkbookPartContent(WorkbookPart workbookPart1) - { - Workbook workbook1 = new Workbook(); - workbook1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); - FileVersion fileVersion1 = new FileVersion() { ApplicationName = "xl", LastEdited = "4", LowestEdited = "4", BuildVersion = "4506" }; - WorkbookProperties workbookProperties1 = new WorkbookProperties() { CodeName = "ThisWorkbook", DefaultThemeVersion = (UInt32Value)124226U }; - - BookViews bookViews1 = new BookViews(); - WorkbookView workbookView1 = new WorkbookView() { XWindow = 0, YWindow = 30, WindowWidth = (UInt32Value)14160U, WindowHeight = (UInt32Value)11580U }; - - bookViews1.Append(workbookView1); - - UInt32 sheetId = 0; - Sheets sheets = new Sheets(); - foreach (var xlWorksheet in this.Worksheets) - { - sheetId++; - Sheet sheet = new Sheet() { Name = xlWorksheet.Name, SheetId = (UInt32Value)sheetId, Id = "rId" + sheetId.ToString() }; - sheets.Append(sheet); - } - - CalculationProperties calculationProperties1 = new CalculationProperties() { CalculationId = (UInt32Value)125725U, CalculationMode = CalculateModeValues.Manual }; - - workbook1.Append(fileVersion1); - workbook1.Append(workbookProperties1); - workbook1.Append(bookViews1); - workbook1.Append(sheets); - workbook1.Append(calculationProperties1); - - workbookPart1.Workbook = workbook1; - } - - // Generates content of worksheetPart3. - private void GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLRange xlWorksheet) - { - Worksheet worksheet = new Worksheet(); - worksheet.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); - SheetProperties sheetProperties = new SheetProperties() { CodeName = xlWorksheet.Name }; - - UInt32 maxColumn = 0; - UInt32 maxRow = 0; - - String sheetDimensionReference = "A1"; - if (xlWorksheet.Cells().Count() > 0) - { - maxColumn = xlWorksheet.Cells().Select(c => c.Address.Column).Max(); - maxRow = xlWorksheet.Cells().Select(c => c.Address.Row).Max(); - sheetDimensionReference = "A1:" + new XLAddress(maxRow, maxColumn).ToString(); - } - - SheetDimension sheetDimension = new SheetDimension() { Reference = sheetDimensionReference }; - - Boolean tabSelected = xlWorksheet.Name == this.Worksheets.First().Name; - - SheetViews sheetViews = new SheetViews(); - SheetView sheetView = new SheetView() { TabSelected = tabSelected, WorkbookViewId = (UInt32Value)0U }; - - sheetViews.Append(sheetView); - SheetFormatProperties sheetFormatProperties3 = new SheetFormatProperties() { DefaultRowHeight = 15D }; - - SheetData sheetData = new SheetData(); - - var distinctRows = xlWorksheet.Cells().Select(c => c.Address.Row).Distinct(); - foreach (var distinctRow in distinctRows.OrderBy(r=>r)) - { - Row row = new Row() { RowIndex = (UInt32Value)distinctRow, Spans = new ListValue() { InnerText = "1:" + maxColumn.ToString() } }; - foreach (XLRange opCell in xlWorksheet.Cells().Where(c => c.Address.Row == distinctRow).Select(c => c)) - { - var styleId = sharedStyles[opCell.Style.ToString()].StyleId; - Cell cell; - var dataType = opCell.DataType; - var cellReference = opCell.Address.ToString(); - if (opCell.DataType == XLCellValues.DateTime) - { - cell = new Cell() - { - CellReference = cellReference, - StyleIndex = styleId - }; - } - else if (styleId == 0) - { - cell = new Cell() - { - CellReference = cellReference, - DataType = GetCellValue(dataType) - }; - } - else - { - cell = new Cell() - { - CellReference = cellReference, - DataType = GetCellValue(dataType), - StyleIndex = styleId - }; - } - CellValue cellValue = new CellValue(); - if (!opCell.HasValue) - { - cellValue.Text = String.Empty; - } - else if (dataType == XLCellValues.SharedString) - { - cellValue.Text = sharedStrings[opCell.Value].ToString(); - } - else - { - cellValue.Text = opCell.Value; - } - - cell.Append(cellValue); - row.Append(cell); - } - sheetData.Append(row); - } - - PageMargins pageMargins = new PageMargins() { Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D }; - Drawing drawing1 = new Drawing() { Id = "rId1" }; - worksheet.Append(sheetProperties); - worksheet.Append(sheetDimension); - worksheet.Append(sheetViews); - worksheet.Append(sheetFormatProperties3); - worksheet.Append(sheetData); - worksheet.Append(pageMargins); - //worksheet.Append(drawing1); - - worksheetPart.Worksheet = worksheet; - } - - // Generates content of sharedStringTablePart1. - private void GenerateSharedStringTablePartContent(SharedStringTablePart sharedStringTablePart) - { - List combined = new List(); - this.Worksheets.ForEach(w => combined.AddRange(w.Cells().Where(c => c.DataType == XLCellValues.SharedString && c.HasValue).Select(c => c.Value).Distinct())); - var distinctStrings = combined.Distinct(); - UInt32 stringCount = (UInt32)distinctStrings.Count(); - SharedStringTable sharedStringTable = new SharedStringTable() { Count = (UInt32Value)stringCount, UniqueCount = (UInt32Value)stringCount }; - - UInt32 stringId = 0; - foreach (var s in distinctStrings) - { - sharedStrings.Add(s, stringId++); - - SharedStringItem sharedStringItem = new SharedStringItem(); - Text text = new Text(); - text.Text = s; - sharedStringItem.Append(text); - sharedStringTable.Append(sharedStringItem); - } - - sharedStringTablePart.SharedStringTable = sharedStringTable; - } - - // Generates content of workbookStylesPart1. - private void GenerateWorkbookStylesPartContent(WorkbookStylesPart workbookStylesPart) - { - var defaultStyle = this.WorkbookStyle; - Dictionary sharedFonts = new Dictionary(); - sharedFonts.Add(defaultStyle.Font.ToString(), new FontInfo() { FontId = 0, Font = defaultStyle.Font }); - - Dictionary sharedFills = new Dictionary(); - sharedFills.Add(defaultStyle.Fill.ToString(), new FillInfo() { FillId = 2, Fill = defaultStyle.Fill }); - - Dictionary sharedBorders = new Dictionary(); - sharedBorders.Add(defaultStyle.Border.ToString(), new BorderInfo() { BorderId = 0, Border = defaultStyle.Border }); - - Dictionary sharedNumberFormats = new Dictionary(); - sharedNumberFormats.Add(defaultStyle.NumberFormat.ToString(), new NumberFormatInfo() { NumberFormatId = 0, NumberFormat = defaultStyle.NumberFormat }); - - sharedStyles.Add(defaultStyle.ToString(), - new StyleInfo() - { - StyleId = 0, - Style = defaultStyle, - FontId = 0, - FillId = 0, - BorderId = 0, - NumberFormatId = 0 - }); - - UInt32 styleCount = 1; - UInt32 fontCount = 1; - UInt32 fillCount = 3; - UInt32 borderCount = 1; - UInt32 numberFormatCount = 1; - - foreach (var worksheet in this.Worksheets) - { - foreach (var cell in worksheet.Cells()) - { - if (!sharedFonts.ContainsKey(cell.Style.Font.ToString())) - { - sharedFonts.Add(cell.Style.Font.ToString(), new FontInfo() { FontId = fontCount++, Font = cell.Style.Font }); - } - - if (!sharedFills.ContainsKey(cell.Style.Fill.ToString())) - { - sharedFills.Add(cell.Style.Fill.ToString(), new FillInfo() { FillId = fillCount++, Fill = cell.Style.Fill }); - } - - if (!sharedBorders.ContainsKey(cell.Style.Border.ToString())) - { - sharedBorders.Add(cell.Style.Border.ToString(), new BorderInfo() { BorderId = borderCount++, Border = cell.Style.Border }); - } - - if (!cell.Style.NumberFormat.NumberFormatId.HasValue && !sharedNumberFormats.ContainsKey(cell.Style.NumberFormat.ToString())) - { - sharedNumberFormats.Add(cell.Style.NumberFormat.ToString(), new NumberFormatInfo() { NumberFormatId = numberFormatCount + 164, NumberFormat = cell.Style.NumberFormat }); - numberFormatCount++; - } - - if (!sharedStyles.ContainsKey(cell.Style.ToString())) - { - UInt32 numberFormatId; - if (cell.Style.NumberFormat.NumberFormatId.HasValue) - numberFormatId = cell.Style.NumberFormat.NumberFormatId.Value; - else - numberFormatId = sharedNumberFormats[cell.Style.NumberFormat.ToString()].NumberFormatId; - - sharedStyles.Add(cell.Style.ToString(), - new StyleInfo() - { - StyleId = styleCount++, - Style = cell.Style, - FontId = sharedFonts[cell.Style.Font.ToString()].FontId, - FillId = sharedFills[cell.Style.Fill.ToString()].FillId, - BorderId = sharedBorders[cell.Style.Border.ToString()].BorderId, - NumberFormatId = numberFormatId - }); - } - } - } - - Stylesheet stylesheet1 = new Stylesheet(); - - NumberingFormats numberingFormats = new NumberingFormats() { Count = (UInt32Value)numberFormatCount }; - foreach (var numberFormatInfo in sharedNumberFormats.Values) - { - NumberingFormat numberingFormat = new NumberingFormat() { NumberFormatId = (UInt32Value)numberFormatInfo.NumberFormatId, FormatCode = numberFormatInfo.NumberFormat.Format }; - numberingFormats.Append(numberingFormat); - } - - Fonts fonts = new Fonts() { Count = (UInt32Value)fontCount }; - - foreach (var fontInfo in sharedFonts.Values) - { - Bold bold = new Bold() { Val = fontInfo.Font.Bold }; - Italic italic = new Italic() { Val = fontInfo.Font.Italic }; - Underline underline = new Underline() { Val = GetUnderlineValue(fontInfo.Font.Underline) }; - Strike strike = new Strike() { Val = fontInfo.Font.Strikethrough }; - VerticalTextAlignment verticalAlignment = new VerticalTextAlignment() { Val = GetVerticalAlignmentRunValue(fontInfo.Font.VerticalAlignment)}; - Font font = new Font(); - FontSize fontSize = new FontSize() { Val = fontInfo.Font.FontSize }; - Color color = new Color() { Rgb = fontInfo.Font.Color }; - FontName fontName = new FontName() { Val = fontInfo.Font.FontName }; - FontFamilyNumbering fontFamilyNumbering = new FontFamilyNumbering() { Val = fontInfo.Font.FontFamilyNumbering }; - FontScheme fontScheme = new FontScheme() { Val = FontSchemeValues.Minor }; - - font.Append(bold); - font.Append(italic); - font.Append(underline); - font.Append(strike); - font.Append(verticalAlignment); - font.Append(fontSize); - font.Append(color); - font.Append(fontName); - font.Append(fontFamilyNumbering); - font.Append(fontScheme); - - fonts.Append(font); - } - - Fills fills = new Fills() { Count = (UInt32Value)fillCount }; - - Fill fill1 = new Fill(); - PatternFill patternFill1 = new PatternFill() { PatternType = PatternValues.None }; - fill1.Append(patternFill1); - fills.Append(fill1); - - Fill fill2 = new Fill(); - PatternFill patternFill2 = new PatternFill() { PatternType = PatternValues.Gray125 }; - fill2.Append(patternFill2); - fills.Append(fill2); - - foreach (var fillInfo in sharedFills.Values) - { - Fill fill = new Fill(); - PatternFill patternFill = new PatternFill() { PatternType = GetPatternValue(fillInfo.Fill.PatternType) }; - ForegroundColor foregroundColor = new ForegroundColor() { Rgb = fillInfo.Fill.PatternColor }; - BackgroundColor backgroundColor = new BackgroundColor() { Rgb = fillInfo.Fill.PatternBackgroundColor }; - - patternFill.Append(foregroundColor); - patternFill.Append(backgroundColor); - - fill.Append(patternFill); - fills.Append(fill); - } - - Borders borders = new Borders() { Count = (UInt32Value)borderCount }; - - foreach (var borderInfo in sharedBorders.Values) - { - Border border = new Border() { DiagonalUp = borderInfo.Border.DiagonalUp, DiagonalDown = borderInfo.Border.DiagonalDown }; - - LeftBorder leftBorder = new LeftBorder() { Style = GetBorderStyleValue(borderInfo.Border.LeftBorder) }; - Color leftBorderColor = new Color() { Rgb = borderInfo.Border.LeftBorderColor }; - leftBorder.Append(leftBorderColor); - border.Append(leftBorder); - - RightBorder rightBorder = new RightBorder() { Style = GetBorderStyleValue(borderInfo.Border.RightBorder) }; - Color rightBorderColor = new Color() { Rgb = borderInfo.Border.RightBorderColor }; - rightBorder.Append(rightBorderColor); - border.Append(rightBorder); - - TopBorder topBorder = new TopBorder() { Style = GetBorderStyleValue(borderInfo.Border.TopBorder) }; - Color topBorderColor = new Color() { Rgb = borderInfo.Border.TopBorderColor }; - topBorder.Append(topBorderColor); - border.Append(topBorder); - - BottomBorder bottomBorder = new BottomBorder() { Style = GetBorderStyleValue(borderInfo.Border.BottomBorder) }; - Color bottomBorderColor = new Color() { Rgb = borderInfo.Border.BottomBorderColor }; - bottomBorder.Append(bottomBorderColor); - border.Append(bottomBorder); - - DiagonalBorder diagonalBorder = new DiagonalBorder() { Style = GetBorderStyleValue(borderInfo.Border.DiagonalBorder) }; - Color diagonalBorderColor = new Color() { Rgb = borderInfo.Border.DiagonalBorderColor }; - diagonalBorder.Append(diagonalBorderColor); - border.Append(diagonalBorder); - - borders.Append(border); - } - - - - // Cell style formats = Formats to be used by the cells and named styles - CellStyleFormats cellStyleFormats = new CellStyleFormats() { Count = (UInt32Value)styleCount }; - // Cell formats = Any kind of formatting applied to a cell - CellFormats cellFormats = new CellFormats() { Count = (UInt32Value)styleCount }; - foreach (var styleInfo in sharedStyles.Values) - { - var formatId = styleInfo.StyleId; - var numberFormatId = styleInfo.NumberFormatId; - var fontId = styleInfo.FontId; - var fillId = styleInfo.FillId; - var borderId = styleInfo.BorderId; - Boolean applyFill = styleInfo.Style.Fill.PatternType == XLFillPatternValues.None; - XLBorder opBorder = styleInfo.Style.Border; - Boolean applyBorder = ( - opBorder.BottomBorder != XLBorderStyleValues.None - || opBorder.DiagonalBorder != XLBorderStyleValues.None - || opBorder.RightBorder != XLBorderStyleValues.None - || opBorder.LeftBorder != XLBorderStyleValues.None - || opBorder.TopBorder != XLBorderStyleValues.None); - - CellFormat cellStyleFormat = new CellFormat() { NumberFormatId = (UInt32Value)numberFormatId, FontId = (UInt32Value)fontId, FillId = (UInt32Value)fillId, BorderId = (UInt32Value)borderId, ApplyNumberFormat = false, ApplyFill = applyFill, ApplyBorder = applyBorder, ApplyAlignment = false, ApplyProtection = false }; - cellStyleFormats.Append(cellStyleFormat); - - CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)numberFormatId, FontId = (UInt32Value)fontId, FillId = (UInt32Value)fillId, BorderId = (UInt32Value)borderId, FormatId = (UInt32Value)formatId, ApplyNumberFormat = false, ApplyFill = applyFill, ApplyBorder = applyBorder, ApplyAlignment = false, ApplyProtection = false }; - Alignment alignment = new Alignment() { Horizontal = GetHorizontalAlignmentValue(styleInfo.Style.Alignment.Horizontal), Vertical = GetVerticalAlignmentValue(styleInfo.Style.Alignment.Vertical), Indent = styleInfo.Style.Alignment.Indent, ReadingOrder = (UInt32)styleInfo.Style.Alignment.ReadingOrder, WrapText = styleInfo.Style.Alignment.WrapText, TextRotation = styleInfo.Style.Alignment.TextRotation, ShrinkToFit = styleInfo.Style.Alignment.ShrinkToFit, RelativeIndent = styleInfo.Style.Alignment.RelativeIndent, JustifyLastLine = styleInfo.Style.Alignment.JustifyLastLine }; - cellFormat.Append(alignment); - - cellFormats.Append(cellFormat); - } - - - - // Cell styles = Named styles - CellStyles cellStyles1 = new CellStyles() { Count = (UInt32Value)1U }; - var defaultFormatId = sharedStyles.Values.Where(s => s.Style.ToString() == this.WorkbookStyle.ToString()).Single().StyleId; - CellStyle cellStyle1 = new CellStyle() { Name = "Normal", FormatId = (UInt32Value)defaultFormatId, BuiltinId = (UInt32Value)0U }; - cellStyles1.Append(cellStyle1); - - DifferentialFormats differentialFormats1 = new DifferentialFormats() { Count = (UInt32Value)0U }; - TableStyles tableStyles1 = new TableStyles() { Count = (UInt32Value)0U, DefaultTableStyle = "TableStyleMedium9", DefaultPivotStyle = "PivotStyleLight16" }; - - stylesheet1.Append(numberingFormats); - stylesheet1.Append(fonts); - stylesheet1.Append(fills); - stylesheet1.Append(borders); - stylesheet1.Append(cellStyleFormats); - stylesheet1.Append(cellFormats); - stylesheet1.Append(cellStyles1); - stylesheet1.Append(differentialFormats1); - stylesheet1.Append(tableStyles1); - - workbookStylesPart.Stylesheet = stylesheet1; - } - - // Generates content of themePart1. - private void GenerateThemePart1Content(ThemePart themePart1) - { - A.Theme theme1 = new A.Theme() { Name = "Office Theme" }; - theme1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); - - A.ThemeElements themeElements1 = new A.ThemeElements(); - - A.ColorScheme colorScheme1 = new A.ColorScheme() { Name = "Office" }; - - A.Dark1Color dark1Color1 = new A.Dark1Color(); - A.SystemColor systemColor1 = new A.SystemColor() { Val = A.SystemColorValues.WindowText, LastColor = "000000" }; - - dark1Color1.Append(systemColor1); - - A.Light1Color light1Color1 = new A.Light1Color(); - A.SystemColor systemColor2 = new A.SystemColor() { Val = A.SystemColorValues.Window, LastColor = "FFFFFF" }; - - light1Color1.Append(systemColor2); - - A.Dark2Color dark2Color1 = new A.Dark2Color(); - A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex() { Val = "1F497D" }; - - dark2Color1.Append(rgbColorModelHex1); - - A.Light2Color light2Color1 = new A.Light2Color(); - A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex() { Val = "EEECE1" }; - - light2Color1.Append(rgbColorModelHex2); - - A.Accent1Color accent1Color1 = new A.Accent1Color(); - A.RgbColorModelHex rgbColorModelHex3 = new A.RgbColorModelHex() { Val = "4F81BD" }; - - accent1Color1.Append(rgbColorModelHex3); - - A.Accent2Color accent2Color1 = new A.Accent2Color(); - A.RgbColorModelHex rgbColorModelHex4 = new A.RgbColorModelHex() { Val = "C0504D" }; - - accent2Color1.Append(rgbColorModelHex4); - - A.Accent3Color accent3Color1 = new A.Accent3Color(); - A.RgbColorModelHex rgbColorModelHex5 = new A.RgbColorModelHex() { Val = "9BBB59" }; - - accent3Color1.Append(rgbColorModelHex5); - - A.Accent4Color accent4Color1 = new A.Accent4Color(); - A.RgbColorModelHex rgbColorModelHex6 = new A.RgbColorModelHex() { Val = "8064A2" }; - - accent4Color1.Append(rgbColorModelHex6); - - A.Accent5Color accent5Color1 = new A.Accent5Color(); - A.RgbColorModelHex rgbColorModelHex7 = new A.RgbColorModelHex() { Val = "4BACC6" }; - - accent5Color1.Append(rgbColorModelHex7); - - A.Accent6Color accent6Color1 = new A.Accent6Color(); - A.RgbColorModelHex rgbColorModelHex8 = new A.RgbColorModelHex() { Val = "F79646" }; - - accent6Color1.Append(rgbColorModelHex8); - - A.Hyperlink hyperlink1 = new A.Hyperlink(); - A.RgbColorModelHex rgbColorModelHex9 = new A.RgbColorModelHex() { Val = "0000FF" }; - - hyperlink1.Append(rgbColorModelHex9); - - A.FollowedHyperlinkColor followedHyperlinkColor1 = new A.FollowedHyperlinkColor(); - A.RgbColorModelHex rgbColorModelHex10 = new A.RgbColorModelHex() { Val = "800080" }; - - followedHyperlinkColor1.Append(rgbColorModelHex10); - - colorScheme1.Append(dark1Color1); - colorScheme1.Append(light1Color1); - colorScheme1.Append(dark2Color1); - colorScheme1.Append(light2Color1); - colorScheme1.Append(accent1Color1); - colorScheme1.Append(accent2Color1); - colorScheme1.Append(accent3Color1); - colorScheme1.Append(accent4Color1); - colorScheme1.Append(accent5Color1); - colorScheme1.Append(accent6Color1); - colorScheme1.Append(hyperlink1); - colorScheme1.Append(followedHyperlinkColor1); - - A.FontScheme fontScheme2 = new A.FontScheme() { Name = "Office" }; - - A.MajorFont majorFont1 = new A.MajorFont(); - A.LatinFont latinFont1 = new A.LatinFont() { Typeface = "Cambria" }; - A.EastAsianFont eastAsianFont1 = new A.EastAsianFont() { Typeface = "" }; - A.ComplexScriptFont complexScriptFont1 = new A.ComplexScriptFont() { Typeface = "" }; - A.SupplementalFont supplementalFont1 = new A.SupplementalFont() { Script = "Jpan", Typeface = "MS Pゴシック" }; - A.SupplementalFont supplementalFont2 = new A.SupplementalFont() { Script = "Hang", Typeface = "맑은 고딕" }; - A.SupplementalFont supplementalFont3 = new A.SupplementalFont() { Script = "Hans", Typeface = "宋体" }; - A.SupplementalFont supplementalFont4 = new A.SupplementalFont() { Script = "Hant", Typeface = "新細明體" }; - A.SupplementalFont supplementalFont5 = new A.SupplementalFont() { Script = "Arab", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont6 = new A.SupplementalFont() { Script = "Hebr", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont7 = new A.SupplementalFont() { Script = "Thai", Typeface = "Tahoma" }; - A.SupplementalFont supplementalFont8 = new A.SupplementalFont() { Script = "Ethi", Typeface = "Nyala" }; - A.SupplementalFont supplementalFont9 = new A.SupplementalFont() { Script = "Beng", Typeface = "Vrinda" }; - A.SupplementalFont supplementalFont10 = new A.SupplementalFont() { Script = "Gujr", Typeface = "Shruti" }; - A.SupplementalFont supplementalFont11 = new A.SupplementalFont() { Script = "Khmr", Typeface = "MoolBoran" }; - A.SupplementalFont supplementalFont12 = new A.SupplementalFont() { Script = "Knda", Typeface = "Tunga" }; - A.SupplementalFont supplementalFont13 = new A.SupplementalFont() { Script = "Guru", Typeface = "Raavi" }; - A.SupplementalFont supplementalFont14 = new A.SupplementalFont() { Script = "Cans", Typeface = "Euphemia" }; - A.SupplementalFont supplementalFont15 = new A.SupplementalFont() { Script = "Cher", Typeface = "Plantagenet Cherokee" }; - A.SupplementalFont supplementalFont16 = new A.SupplementalFont() { Script = "Yiii", Typeface = "Microsoft Yi Baiti" }; - A.SupplementalFont supplementalFont17 = new A.SupplementalFont() { Script = "Tibt", Typeface = "Microsoft Himalaya" }; - A.SupplementalFont supplementalFont18 = new A.SupplementalFont() { Script = "Thaa", Typeface = "MV Boli" }; - A.SupplementalFont supplementalFont19 = new A.SupplementalFont() { Script = "Deva", Typeface = "Mangal" }; - A.SupplementalFont supplementalFont20 = new A.SupplementalFont() { Script = "Telu", Typeface = "Gautami" }; - A.SupplementalFont supplementalFont21 = new A.SupplementalFont() { Script = "Taml", Typeface = "Latha" }; - A.SupplementalFont supplementalFont22 = new A.SupplementalFont() { Script = "Syrc", Typeface = "Estrangelo Edessa" }; - A.SupplementalFont supplementalFont23 = new A.SupplementalFont() { Script = "Orya", Typeface = "Kalinga" }; - A.SupplementalFont supplementalFont24 = new A.SupplementalFont() { Script = "Mlym", Typeface = "Kartika" }; - A.SupplementalFont supplementalFont25 = new A.SupplementalFont() { Script = "Laoo", Typeface = "DokChampa" }; - A.SupplementalFont supplementalFont26 = new A.SupplementalFont() { Script = "Sinh", Typeface = "Iskoola Pota" }; - A.SupplementalFont supplementalFont27 = new A.SupplementalFont() { Script = "Mong", Typeface = "Mongolian Baiti" }; - A.SupplementalFont supplementalFont28 = new A.SupplementalFont() { Script = "Viet", Typeface = "Times New Roman" }; - A.SupplementalFont supplementalFont29 = new A.SupplementalFont() { Script = "Uigh", Typeface = "Microsoft Uighur" }; - - majorFont1.Append(latinFont1); - majorFont1.Append(eastAsianFont1); - majorFont1.Append(complexScriptFont1); - majorFont1.Append(supplementalFont1); - majorFont1.Append(supplementalFont2); - majorFont1.Append(supplementalFont3); - majorFont1.Append(supplementalFont4); - majorFont1.Append(supplementalFont5); - majorFont1.Append(supplementalFont6); - majorFont1.Append(supplementalFont7); - majorFont1.Append(supplementalFont8); - majorFont1.Append(supplementalFont9); - majorFont1.Append(supplementalFont10); - majorFont1.Append(supplementalFont11); - majorFont1.Append(supplementalFont12); - majorFont1.Append(supplementalFont13); - majorFont1.Append(supplementalFont14); - majorFont1.Append(supplementalFont15); - majorFont1.Append(supplementalFont16); - majorFont1.Append(supplementalFont17); - majorFont1.Append(supplementalFont18); - majorFont1.Append(supplementalFont19); - majorFont1.Append(supplementalFont20); - majorFont1.Append(supplementalFont21); - majorFont1.Append(supplementalFont22); - majorFont1.Append(supplementalFont23); - majorFont1.Append(supplementalFont24); - majorFont1.Append(supplementalFont25); - majorFont1.Append(supplementalFont26); - majorFont1.Append(supplementalFont27); - majorFont1.Append(supplementalFont28); - majorFont1.Append(supplementalFont29); - - A.MinorFont minorFont1 = new A.MinorFont(); - A.LatinFont latinFont2 = new A.LatinFont() { Typeface = "Calibri" }; - A.EastAsianFont eastAsianFont2 = new A.EastAsianFont() { Typeface = "" }; - A.ComplexScriptFont complexScriptFont2 = new A.ComplexScriptFont() { Typeface = "" }; - A.SupplementalFont supplementalFont30 = new A.SupplementalFont() { Script = "Jpan", Typeface = "MS Pゴシック" }; - A.SupplementalFont supplementalFont31 = new A.SupplementalFont() { Script = "Hang", Typeface = "맑은 고딕" }; - A.SupplementalFont supplementalFont32 = new A.SupplementalFont() { Script = "Hans", Typeface = "宋体" }; - A.SupplementalFont supplementalFont33 = new A.SupplementalFont() { Script = "Hant", Typeface = "新細明體" }; - A.SupplementalFont supplementalFont34 = new A.SupplementalFont() { Script = "Arab", Typeface = "Arial" }; - A.SupplementalFont supplementalFont35 = new A.SupplementalFont() { Script = "Hebr", Typeface = "Arial" }; - A.SupplementalFont supplementalFont36 = new A.SupplementalFont() { Script = "Thai", Typeface = "Tahoma" }; - A.SupplementalFont supplementalFont37 = new A.SupplementalFont() { Script = "Ethi", Typeface = "Nyala" }; - A.SupplementalFont supplementalFont38 = new A.SupplementalFont() { Script = "Beng", Typeface = "Vrinda" }; - A.SupplementalFont supplementalFont39 = new A.SupplementalFont() { Script = "Gujr", Typeface = "Shruti" }; - A.SupplementalFont supplementalFont40 = new A.SupplementalFont() { Script = "Khmr", Typeface = "DaunPenh" }; - A.SupplementalFont supplementalFont41 = new A.SupplementalFont() { Script = "Knda", Typeface = "Tunga" }; - A.SupplementalFont supplementalFont42 = new A.SupplementalFont() { Script = "Guru", Typeface = "Raavi" }; - A.SupplementalFont supplementalFont43 = new A.SupplementalFont() { Script = "Cans", Typeface = "Euphemia" }; - A.SupplementalFont supplementalFont44 = new A.SupplementalFont() { Script = "Cher", Typeface = "Plantagenet Cherokee" }; - A.SupplementalFont supplementalFont45 = new A.SupplementalFont() { Script = "Yiii", Typeface = "Microsoft Yi Baiti" }; - A.SupplementalFont supplementalFont46 = new A.SupplementalFont() { Script = "Tibt", Typeface = "Microsoft Himalaya" }; - A.SupplementalFont supplementalFont47 = new A.SupplementalFont() { Script = "Thaa", Typeface = "MV Boli" }; - A.SupplementalFont supplementalFont48 = new A.SupplementalFont() { Script = "Deva", Typeface = "Mangal" }; - A.SupplementalFont supplementalFont49 = new A.SupplementalFont() { Script = "Telu", Typeface = "Gautami" }; - A.SupplementalFont supplementalFont50 = new A.SupplementalFont() { Script = "Taml", Typeface = "Latha" }; - A.SupplementalFont supplementalFont51 = new A.SupplementalFont() { Script = "Syrc", Typeface = "Estrangelo Edessa" }; - A.SupplementalFont supplementalFont52 = new A.SupplementalFont() { Script = "Orya", Typeface = "Kalinga" }; - A.SupplementalFont supplementalFont53 = new A.SupplementalFont() { Script = "Mlym", Typeface = "Kartika" }; - A.SupplementalFont supplementalFont54 = new A.SupplementalFont() { Script = "Laoo", Typeface = "DokChampa" }; - A.SupplementalFont supplementalFont55 = new A.SupplementalFont() { Script = "Sinh", Typeface = "Iskoola Pota" }; - A.SupplementalFont supplementalFont56 = new A.SupplementalFont() { Script = "Mong", Typeface = "Mongolian Baiti" }; - A.SupplementalFont supplementalFont57 = new A.SupplementalFont() { Script = "Viet", Typeface = "Arial" }; - A.SupplementalFont supplementalFont58 = new A.SupplementalFont() { Script = "Uigh", Typeface = "Microsoft Uighur" }; - - minorFont1.Append(latinFont2); - minorFont1.Append(eastAsianFont2); - minorFont1.Append(complexScriptFont2); - minorFont1.Append(supplementalFont30); - minorFont1.Append(supplementalFont31); - minorFont1.Append(supplementalFont32); - minorFont1.Append(supplementalFont33); - minorFont1.Append(supplementalFont34); - minorFont1.Append(supplementalFont35); - minorFont1.Append(supplementalFont36); - minorFont1.Append(supplementalFont37); - minorFont1.Append(supplementalFont38); - minorFont1.Append(supplementalFont39); - minorFont1.Append(supplementalFont40); - minorFont1.Append(supplementalFont41); - minorFont1.Append(supplementalFont42); - minorFont1.Append(supplementalFont43); - minorFont1.Append(supplementalFont44); - minorFont1.Append(supplementalFont45); - minorFont1.Append(supplementalFont46); - minorFont1.Append(supplementalFont47); - minorFont1.Append(supplementalFont48); - minorFont1.Append(supplementalFont49); - minorFont1.Append(supplementalFont50); - minorFont1.Append(supplementalFont51); - minorFont1.Append(supplementalFont52); - minorFont1.Append(supplementalFont53); - minorFont1.Append(supplementalFont54); - minorFont1.Append(supplementalFont55); - minorFont1.Append(supplementalFont56); - minorFont1.Append(supplementalFont57); - minorFont1.Append(supplementalFont58); - - fontScheme2.Append(majorFont1); - fontScheme2.Append(minorFont1); - - A.FormatScheme formatScheme1 = new A.FormatScheme() { Name = "Office" }; - - A.FillStyleList fillStyleList1 = new A.FillStyleList(); - - A.SolidFill solidFill1 = new A.SolidFill(); - A.SchemeColor schemeColor1 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill1.Append(schemeColor1); - - A.GradientFill gradientFill1 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList1 = new A.GradientStopList(); - - A.GradientStop gradientStop1 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor2 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint1 = new A.Tint() { Val = 50000 }; - A.SaturationModulation saturationModulation1 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor2.Append(tint1); - schemeColor2.Append(saturationModulation1); - - gradientStop1.Append(schemeColor2); - - A.GradientStop gradientStop2 = new A.GradientStop() { Position = 35000 }; - - A.SchemeColor schemeColor3 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint2 = new A.Tint() { Val = 37000 }; - A.SaturationModulation saturationModulation2 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor3.Append(tint2); - schemeColor3.Append(saturationModulation2); - - gradientStop2.Append(schemeColor3); - - A.GradientStop gradientStop3 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor4 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint3 = new A.Tint() { Val = 15000 }; - A.SaturationModulation saturationModulation3 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor4.Append(tint3); - schemeColor4.Append(saturationModulation3); - - gradientStop3.Append(schemeColor4); - - gradientStopList1.Append(gradientStop1); - gradientStopList1.Append(gradientStop2); - gradientStopList1.Append(gradientStop3); - A.LinearGradientFill linearGradientFill1 = new A.LinearGradientFill() { Angle = 16200000, Scaled = true }; - - gradientFill1.Append(gradientStopList1); - gradientFill1.Append(linearGradientFill1); - - A.GradientFill gradientFill2 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList2 = new A.GradientStopList(); - - A.GradientStop gradientStop4 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor5 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade1 = new A.Shade() { Val = 51000 }; - A.SaturationModulation saturationModulation4 = new A.SaturationModulation() { Val = 130000 }; - - schemeColor5.Append(shade1); - schemeColor5.Append(saturationModulation4); - - gradientStop4.Append(schemeColor5); - - A.GradientStop gradientStop5 = new A.GradientStop() { Position = 80000 }; - - A.SchemeColor schemeColor6 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade2 = new A.Shade() { Val = 93000 }; - A.SaturationModulation saturationModulation5 = new A.SaturationModulation() { Val = 130000 }; - - schemeColor6.Append(shade2); - schemeColor6.Append(saturationModulation5); - - gradientStop5.Append(schemeColor6); - - A.GradientStop gradientStop6 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor7 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade3 = new A.Shade() { Val = 94000 }; - A.SaturationModulation saturationModulation6 = new A.SaturationModulation() { Val = 135000 }; - - schemeColor7.Append(shade3); - schemeColor7.Append(saturationModulation6); - - gradientStop6.Append(schemeColor7); - - gradientStopList2.Append(gradientStop4); - gradientStopList2.Append(gradientStop5); - gradientStopList2.Append(gradientStop6); - A.LinearGradientFill linearGradientFill2 = new A.LinearGradientFill() { Angle = 16200000, Scaled = false }; - - gradientFill2.Append(gradientStopList2); - gradientFill2.Append(linearGradientFill2); - - fillStyleList1.Append(solidFill1); - fillStyleList1.Append(gradientFill1); - fillStyleList1.Append(gradientFill2); - - A.LineStyleList lineStyleList1 = new A.LineStyleList(); - - A.Outline outline1 = new A.Outline() { Width = 9525, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill2 = new A.SolidFill(); - - A.SchemeColor schemeColor8 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade4 = new A.Shade() { Val = 95000 }; - A.SaturationModulation saturationModulation7 = new A.SaturationModulation() { Val = 105000 }; - - schemeColor8.Append(shade4); - schemeColor8.Append(saturationModulation7); - - solidFill2.Append(schemeColor8); - A.PresetDash presetDash1 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline1.Append(solidFill2); - outline1.Append(presetDash1); - - A.Outline outline2 = new A.Outline() { Width = 25400, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill3 = new A.SolidFill(); - A.SchemeColor schemeColor9 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill3.Append(schemeColor9); - A.PresetDash presetDash2 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline2.Append(solidFill3); - outline2.Append(presetDash2); - - A.Outline outline3 = new A.Outline() { Width = 38100, CapType = A.LineCapValues.Flat, CompoundLineType = A.CompoundLineValues.Single, Alignment = A.PenAlignmentValues.Center }; - - A.SolidFill solidFill4 = new A.SolidFill(); - A.SchemeColor schemeColor10 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill4.Append(schemeColor10); - A.PresetDash presetDash3 = new A.PresetDash() { Val = A.PresetLineDashValues.Solid }; - - outline3.Append(solidFill4); - outline3.Append(presetDash3); - - lineStyleList1.Append(outline1); - lineStyleList1.Append(outline2); - lineStyleList1.Append(outline3); - - A.EffectStyleList effectStyleList1 = new A.EffectStyleList(); - - A.EffectStyle effectStyle1 = new A.EffectStyle(); - - A.EffectList effectList1 = new A.EffectList(); - - A.OuterShadow outerShadow1 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 20000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex11 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha1 = new A.Alpha() { Val = 38000 }; - - rgbColorModelHex11.Append(alpha1); - - outerShadow1.Append(rgbColorModelHex11); - - effectList1.Append(outerShadow1); - - effectStyle1.Append(effectList1); - - A.EffectStyle effectStyle2 = new A.EffectStyle(); - - A.EffectList effectList2 = new A.EffectList(); - - A.OuterShadow outerShadow2 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 23000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex12 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha2 = new A.Alpha() { Val = 35000 }; - - rgbColorModelHex12.Append(alpha2); - - outerShadow2.Append(rgbColorModelHex12); - - effectList2.Append(outerShadow2); - - effectStyle2.Append(effectList2); - - A.EffectStyle effectStyle3 = new A.EffectStyle(); - - A.EffectList effectList3 = new A.EffectList(); - - A.OuterShadow outerShadow3 = new A.OuterShadow() { BlurRadius = 40000L, Distance = 23000L, Direction = 5400000, RotateWithShape = false }; - - A.RgbColorModelHex rgbColorModelHex13 = new A.RgbColorModelHex() { Val = "000000" }; - A.Alpha alpha3 = new A.Alpha() { Val = 35000 }; - - rgbColorModelHex13.Append(alpha3); - - outerShadow3.Append(rgbColorModelHex13); - - effectList3.Append(outerShadow3); - - A.Scene3DType scene3DType1 = new A.Scene3DType(); - - A.Camera camera1 = new A.Camera() { Preset = A.PresetCameraValues.OrthographicFront }; - A.Rotation rotation1 = new A.Rotation() { Latitude = 0, Longitude = 0, Revolution = 0 }; - - camera1.Append(rotation1); - - A.LightRig lightRig1 = new A.LightRig() { Rig = A.LightRigValues.ThreePoints, Direction = A.LightRigDirectionValues.Top }; - A.Rotation rotation2 = new A.Rotation() { Latitude = 0, Longitude = 0, Revolution = 1200000 }; - - lightRig1.Append(rotation2); - - scene3DType1.Append(camera1); - scene3DType1.Append(lightRig1); - - A.Shape3DType shape3DType1 = new A.Shape3DType(); - A.BevelTop bevelTop1 = new A.BevelTop() { Width = 63500L, Height = 25400L }; - - shape3DType1.Append(bevelTop1); - - effectStyle3.Append(effectList3); - effectStyle3.Append(scene3DType1); - effectStyle3.Append(shape3DType1); - - effectStyleList1.Append(effectStyle1); - effectStyleList1.Append(effectStyle2); - effectStyleList1.Append(effectStyle3); - - A.BackgroundFillStyleList backgroundFillStyleList1 = new A.BackgroundFillStyleList(); - - A.SolidFill solidFill5 = new A.SolidFill(); - A.SchemeColor schemeColor11 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - - solidFill5.Append(schemeColor11); - - A.GradientFill gradientFill3 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList3 = new A.GradientStopList(); - - A.GradientStop gradientStop7 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor12 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint4 = new A.Tint() { Val = 40000 }; - A.SaturationModulation saturationModulation8 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor12.Append(tint4); - schemeColor12.Append(saturationModulation8); - - gradientStop7.Append(schemeColor12); - - A.GradientStop gradientStop8 = new A.GradientStop() { Position = 40000 }; - - A.SchemeColor schemeColor13 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint5 = new A.Tint() { Val = 45000 }; - A.Shade shade5 = new A.Shade() { Val = 99000 }; - A.SaturationModulation saturationModulation9 = new A.SaturationModulation() { Val = 350000 }; - - schemeColor13.Append(tint5); - schemeColor13.Append(shade5); - schemeColor13.Append(saturationModulation9); - - gradientStop8.Append(schemeColor13); - - A.GradientStop gradientStop9 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor14 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade6 = new A.Shade() { Val = 20000 }; - A.SaturationModulation saturationModulation10 = new A.SaturationModulation() { Val = 255000 }; - - schemeColor14.Append(shade6); - schemeColor14.Append(saturationModulation10); - - gradientStop9.Append(schemeColor14); - - gradientStopList3.Append(gradientStop7); - gradientStopList3.Append(gradientStop8); - gradientStopList3.Append(gradientStop9); - - A.PathGradientFill pathGradientFill1 = new A.PathGradientFill() { Path = A.PathShadeValues.Circle }; - A.FillToRectangle fillToRectangle1 = new A.FillToRectangle() { Left = 50000, Top = -80000, Right = 50000, Bottom = 180000 }; - - pathGradientFill1.Append(fillToRectangle1); - - gradientFill3.Append(gradientStopList3); - gradientFill3.Append(pathGradientFill1); - - A.GradientFill gradientFill4 = new A.GradientFill() { RotateWithShape = true }; - - A.GradientStopList gradientStopList4 = new A.GradientStopList(); - - A.GradientStop gradientStop10 = new A.GradientStop() { Position = 0 }; - - A.SchemeColor schemeColor15 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Tint tint6 = new A.Tint() { Val = 80000 }; - A.SaturationModulation saturationModulation11 = new A.SaturationModulation() { Val = 300000 }; - - schemeColor15.Append(tint6); - schemeColor15.Append(saturationModulation11); - - gradientStop10.Append(schemeColor15); - - A.GradientStop gradientStop11 = new A.GradientStop() { Position = 100000 }; - - A.SchemeColor schemeColor16 = new A.SchemeColor() { Val = A.SchemeColorValues.PhColor }; - A.Shade shade7 = new A.Shade() { Val = 30000 }; - A.SaturationModulation saturationModulation12 = new A.SaturationModulation() { Val = 200000 }; - - schemeColor16.Append(shade7); - schemeColor16.Append(saturationModulation12); - - gradientStop11.Append(schemeColor16); - - gradientStopList4.Append(gradientStop10); - gradientStopList4.Append(gradientStop11); - - A.PathGradientFill pathGradientFill2 = new A.PathGradientFill() { Path = A.PathShadeValues.Circle }; - A.FillToRectangle fillToRectangle2 = new A.FillToRectangle() { Left = 50000, Top = 50000, Right = 50000, Bottom = 50000 }; - - pathGradientFill2.Append(fillToRectangle2); - - gradientFill4.Append(gradientStopList4); - gradientFill4.Append(pathGradientFill2); - - backgroundFillStyleList1.Append(solidFill5); - backgroundFillStyleList1.Append(gradientFill3); - backgroundFillStyleList1.Append(gradientFill4); - - formatScheme1.Append(fillStyleList1); - formatScheme1.Append(lineStyleList1); - formatScheme1.Append(effectStyleList1); - formatScheme1.Append(backgroundFillStyleList1); - - themeElements1.Append(colorScheme1); - themeElements1.Append(fontScheme2); - themeElements1.Append(formatScheme1); - A.ObjectDefaults objectDefaults1 = new A.ObjectDefaults(); - A.ExtraColorSchemeList extraColorSchemeList1 = new A.ExtraColorSchemeList(); - - theme1.Append(themeElements1); - theme1.Append(objectDefaults1); - theme1.Append(extraColorSchemeList1); - - themePart1.Theme = theme1; - } - - private void SetPackageProperties(OpenXmlPackage document) - { - document.PackageProperties.Creator = ""; - document.PackageProperties.Created = DateTime.Now; - document.PackageProperties.Modified = DateTime.Now; - document.PackageProperties.LastModifiedBy = ""; - } - - } -} diff --git a/ClosedXML/ClosedXML/Excel/XLWorksheets.cs b/ClosedXML/ClosedXML/Excel/XLWorksheets.cs deleted file mode 100644 index 982423d..0000000 --- a/ClosedXML/ClosedXML/Excel/XLWorksheets.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML.Excel -{ - /// - /// Allows you to add, access, and remove worksheets from the workbook. - /// - public class XLWorksheets: IEnumerable - { - #region Constants - - private const UInt32 MaxNumberOfRows = 1048576; - private const UInt32 MaxNumberOfColumns = 16384; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The workbook which will contain the worksheets. - public XLWorksheets(XLWorkbook workbook) - { - this.workbook = workbook; - } - - #endregion - - #region Properties - - private Dictionary worksheets = new Dictionary(); - - private XLWorkbook workbook; - - /// - /// Gets the number of worksheets in the workbook. - /// - public UInt32 Count - { - get - { - return (UInt32)worksheets.Count; - } - } - - /// - /// Gets the worksheet (as an XLRange) with the specified sheet name. - /// - /// - public XLRange this[String sheetName] - { - get - { - return worksheets[sheetName]; - } - } - - #endregion - - #region Methods - - /// - /// Adds a new worksheet to the workbook. - /// - /// The name of the worksheet to be added. - public XLRange Add(String name) - { - var firstCellAddress = new XLAddress(1, 1); - var lastCellAddress = new XLAddress(MaxNumberOfRows, MaxNumberOfColumns); - XLRange worksheet = new XLRange(firstCellAddress, lastCellAddress, null, null, name, workbook); - worksheets.Add(name, worksheet); - return worksheet; - } - - /// - /// Deletes the specified worksheet from the workbook. - /// - /// The name of the worksheet to be deleted. - public void Delete(String name) - { - worksheets.Remove(name); - } - - #endregion - - - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - return worksheets.Values.GetEnumerator(); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - #endregion - } -} diff --git a/ClosedXML/ClosedXML/Extensions.cs b/ClosedXML/ClosedXML/Extensions.cs deleted file mode 100644 index 57e2604..0000000 --- a/ClosedXML/ClosedXML/Extensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML -{ - public static class Extensions - { - // Adds the .ForEach method to all IEnumerables - public static void ForEach(this IEnumerable source, Action action) - { - foreach (T item in source) - action(item); - } - } -} diff --git a/ClosedXML/ClosedXML/Local.testsettings b/ClosedXML/ClosedXML/Local.testsettings deleted file mode 100644 index 49edf89..0000000 --- a/ClosedXML/ClosedXML/Local.testsettings +++ /dev/null @@ -1,10 +0,0 @@ - - - These are default test settings for a local test run. - - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs deleted file mode 100644 index 367a544..0000000 --- a/ClosedXML/ClosedXML/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("8747331d-de58-4621-8c7f-a7d57ca3467a")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML/TraceAndTestImpact.testsettings b/ClosedXML/ClosedXML/TraceAndTestImpact.testsettings deleted file mode 100644 index 0792b9b..0000000 --- a/ClosedXML/ClosedXML/TraceAndTestImpact.testsettings +++ /dev/null @@ -1,21 +0,0 @@ - - - These are test settings for Trace and Test Impact. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML_Examples/BasicTable.cs b/ClosedXML/ClosedXML_Examples/BasicTable.cs deleted file mode 100644 index 5d9c652..0000000 --- a/ClosedXML/ClosedXML_Examples/BasicTable.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Examples -{ - public class BasicTable - { - public void Create(String filePath) - { - var wb = new XLWorkbook(filePath); - var ws = wb.Worksheets.Add("Contacts"); - - //First Names - ws.Cell("A1").Value = "FName"; - ws.Cell("A2").Value = "John"; - ws.Cell("A3").Value = "Hank"; - ws.Cell("A4").Value = "Dagny"; - //Last Names - ws.Cell("B1").Value = "LName"; - ws.Cell("B2").Value = "Galt"; - ws.Cell("B3").Value = "Rearden"; - ws.Cell("B4").Value = "Taggart"; - //Is an outcast? - ws.Cell("C1").Value = "Outcast"; - ws.Cell("C2").Value = true.ToString(); - ws.Cell("C3").Value = false.ToString(); - ws.Cell("C4").Value = false.ToString(); - //Date of Birth - ws.Cell("D1").Value = "DOB"; - ws.Cell("D2").Value = new DateTime(1919, 1, 21).ToString(); - ws.Cell("D3").Value = new DateTime(1907, 3, 4).ToString(); - ws.Cell("D4").Value = new DateTime(1921, 12, 15).ToString(); - //Income - ws.Cell("E1").Value = "Income"; - ws.Cell("E2").Value = "2000"; - ws.Cell("E3").Value = "40000"; - ws.Cell("E4").Value = "10000"; - - var rngDates = ws.Range("D2:D4"); - var rngNumbers = ws.Range("E2:E4"); - - rngDates.Style.NumberFormat.Format = "mm-dd-yy"; - rngNumbers.Style.NumberFormat.Format = "$ #,##0"; - - var rngHeaders = ws.Range("A1:E1"); - rngHeaders.Style.Font.Bold = true; - rngHeaders.Style.Fill.BackgroundColor = "6BE8FF"; - - var rngTable = ws.Range("A1:E4"); - rngTable.Style.Border.BottomBorder = XLBorderStyleValues.Thin; - - wb.Save(); - } - } -} diff --git a/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj b/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj deleted file mode 100644 index 21f0231..0000000 --- a/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {03A518D0-1CB7-488E-861C-C4E782B27A46} - Exe - Properties - ClosedXML_Examples - ClosedXML_Examples - v4.0 - Client - 512 - SAK - SAK - SAK - SAK - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - ClosedXML - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc b/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML_Examples/ClosedXML_Examples.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML_Examples/HelloWorld.cs b/ClosedXML/ClosedXML_Examples/HelloWorld.cs deleted file mode 100644 index 0c6a2d9..0000000 --- a/ClosedXML/ClosedXML_Examples/HelloWorld.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; - -namespace ClosedXML_Examples -{ - public class HelloWorld - { - public void Create(String filePath) - { - var workbook = new XLWorkbook(filePath); - var worksheet = workbook.Worksheets.Add("Sample Sheet"); - worksheet.Cell("A1").Value = "Hello World!"; - workbook.Save(); - } - } -} diff --git a/ClosedXML/ClosedXML_Examples/Program.cs b/ClosedXML/ClosedXML_Examples/Program.cs deleted file mode 100644 index 5730cdd..0000000 --- a/ClosedXML/ClosedXML_Examples/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ClosedXML_Examples -{ - class Program - { - static void Main(string[] args) - { - var helloWorld = new HelloWorld(); - helloWorld.Create(@"c:\HelloWorld.xlsx"); - - var basicTable = new BasicTable(); - basicTable.Create(@"c:\BasicTable.xlsx"); - } - } -} diff --git a/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs deleted file mode 100644 index d492c06..0000000 --- a/ClosedXML/ClosedXML_Examples/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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_Examples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML_Examples")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("603cd89c-23f2-415e-8afc-2e9ab7a4c372")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj b/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj deleted file mode 100644 index ff83f9e..0000000 --- a/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {38B882F0-E6F2-45C5-9BE9-CDC27FBEB4AB} - Exe - Properties - ClosedXML_Sandbox - ClosedXML_Sandbox - v4.0 - Client - 512 - SAK - SAK - SAK - SAK - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - ClosedXML - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc b/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML_Sandbox/ClosedXML_Sandbox.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML_Sandbox/Program.cs b/ClosedXML/ClosedXML_Sandbox/Program.cs deleted file mode 100644 index 7fd8ae9..0000000 --- a/ClosedXML/ClosedXML_Sandbox/Program.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ClosedXML.Excel; -using ClosedXML.Excel.Style; - -namespace ClosedXML_Sandbox -{ - class Program - { - static void Main(string[] args) - { - var wb = new XLWorkbook(@"c:\ContactList.xlsx"); - var ws = wb.Worksheets.Add("Contacts"); - //First Names - ws.Cell("A1").Value = "FName"; - ws.Cell("A2").Value = "John"; - ws.Cell("A3").Value = "Hank"; - ws.Cell("A4").Value = "Dagny"; - //Last Names - ws.Cell("B1").Value = "LName"; - ws.Cell("B2").Value = "Galt"; - ws.Cell("B3").Value = "Rearden"; - ws.Cell("B4").Value = "Taggart"; - //Is an outcast? - ws.Cell("C1").Value = "Outcast"; - ws.Cell("C2").Value = true.ToString(); - ws.Cell("C3").Value = false.ToString(); - ws.Cell("C4").Value = false.ToString(); - //Date of Birth - ws.Cell("D1").Value = "DOB"; - ws.Cell("D2").Value = new DateTime(1919, 1, 21).ToString(); - ws.Cell("D3").Value = new DateTime(1907, 3, 4).ToString(); - ws.Cell("D4").Value = new DateTime(1921, 12, 15).ToString(); - //Income - ws.Cell("E1").Value = "Income"; - ws.Cell("E2").Value = "2000"; - ws.Cell("E3").Value = "40000"; - ws.Cell("E4").Value = "10000"; - - var rngDates = ws.Range("D2:D4"); - var rngNumbers = ws.Range("E2:E4"); - - rngDates.Style.NumberFormat.Format = "mm-dd-yy"; - rngNumbers.Style.NumberFormat.Format = "$ #,##0"; - - var rngHeaders = ws.Range("A1:E1"); - rngHeaders.Style.Font.Bold = true; - rngHeaders.Style.Fill.BackgroundColor = "6BE8FF"; - - - - wb.Save(); - } - } -} diff --git a/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs deleted file mode 100644 index 942db94..0000000 --- a/ClosedXML/ClosedXML_Sandbox/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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_Sandbox")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML_Sandbox")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("7a3783fd-4e1b-4c17-a745-e6bbb593bd45")] - -// 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("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj b/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj deleted file mode 100644 index 8ec6041..0000000 --- a/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {D41B4F43-AB44-4236-B959-D508D259F4A7} - Library - Properties - ClosedXML_Test - ClosedXML_Test - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - SAK - SAK - SAK - SAK - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - 3.5 - - - - - - - - - - False - - - - - - - - - - - {BD5E6BFE-E837-4A35-BCA9-39667D873A20} - ClosedXML - - - - - \ No newline at end of file diff --git a/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj.vspscc b/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj.vspscc deleted file mode 100644 index feffdec..0000000 --- a/ClosedXML/ClosedXML_Test/ClosedXML_Test.csproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/ClosedXML/ClosedXML_Test/Properties/AssemblyInfo.cs b/ClosedXML/ClosedXML_Test/Properties/AssemblyInfo.cs deleted file mode 100644 index 7a3a012..0000000 --- a/ClosedXML/ClosedXML_Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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_Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("ClosedXML_Test")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] -[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("6acc873b-86e7-4c3d-89e6-3e409183c5ec")] - -// 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.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ClosedXML/ClosedXML_Test/XLAddressTest.cs b/ClosedXML/ClosedXML_Test/XLAddressTest.cs deleted file mode 100644 index 6172051..0000000 --- a/ClosedXML/ClosedXML_Test/XLAddressTest.cs +++ /dev/null @@ -1,401 +0,0 @@ -using ClosedXML.Excel; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; - -namespace ClosedXML_Test -{ - - - /// - ///This is a test class for XLAddressTest and is intended - ///to contain all XLAddressTest Unit Tests - /// - [TestClass()] - public class XLAddressTest - { - - - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - #region Additional test attributes - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - //[ClassInitialize()] - //public static void MyClassInitialize(TestContext testContext) - //{ - //} - // - //Use ClassCleanup to run code after all tests in a class have run - //[ClassCleanup()] - //public static void MyClassCleanup() - //{ - //} - // - //Use TestInitialize to run code before running each test - //[TestInitialize()] - //public void MyTestInitialize() - //{ - //} - // - //Use TestCleanup to run code after each test has run - //[TestCleanup()] - //public void MyTestCleanup() - //{ - //} - // - #endregion - - - /// - ///A test for XLAddress Constructor - /// - [TestMethod()] - public void XLAddress_R1C1Constructor_Test() - { - uint row = 4; - uint column = 4; - XLAddress target = new XLAddress(row, column); - - Assert.AreEqual(target.Row, 4U); - Assert.AreEqual(target.Column, 4U); - Assert.AreEqual(target.ColumnLetter, "D"); - } - - [TestMethod()] - public void XLAddress_A1Constructor_Test() - { - String address = "D4"; - XLAddress target = new XLAddress(address); - - Assert.AreEqual(target.Row, 4U); - Assert.AreEqual(target.Column, 4U); - Assert.AreEqual(target.ColumnLetter, "D"); - } - - [TestMethod()] - public void XLAddress_MixedConstructor_Test() - { - uint row = 4; - String columnLetter = "D"; - XLAddress target = new XLAddress(row, columnLetter); - - Assert.AreEqual(target.Row, 4U); - Assert.AreEqual(target.Column, 4U); - Assert.AreEqual(target.ColumnLetter, "D"); - } - - /// - ///A test for GetColumnNumberFromLetter - /// - [TestMethod()] - public void GetColumnNumberFromLetterTest() - { - string column = "OMV"; - uint expected = 10500; - uint actual; - actual = XLAddress.GetColumnNumberFromLetter(column); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for GetColumnLetterFromNumber - /// - [TestMethod()] - public void GetColumnLetterFromNumberTest() - { - uint column = 10500; - string expected = "OMV"; - string actual; - actual = XLAddress.GetColumnLetterFromNumber(column); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Addition - /// - [TestMethod()] - public void op_AdditionTest() - { - XLAddress xlCellAddressLeft = new XLAddress(7, 5); - uint right = 1; - XLAddress expected = new XLAddress(8,6); - XLAddress actual; - actual = (xlCellAddressLeft + right); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Addition - /// - [TestMethod()] - public void op_AdditionTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(7,5); - XLAddress xlCellAddressRight = new XLAddress(10, 3); - XLAddress expected = new XLAddress(17, 8); - XLAddress actual; - actual = (xlCellAddressLeft + xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Equality - /// - [TestMethod()] - public void op_EqualityTest() - { - XLAddress xlCellAddressLeft = new XLAddress(1,1); - XLAddress xlCellAddressRight = new XLAddress(1,1); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft == xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_EqualityTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(1, 1); - XLAddress xlCellAddressRight = new XLAddress(1, 2); - bool expected = false; - bool actual; - actual = (xlCellAddressLeft == xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_GreaterThan - /// - [TestMethod()] - public void op_GreaterThanTest() - { - XLAddress xlCellAddressLeft = new XLAddress(3,3); - XLAddress xlCellAddressRight = new XLAddress(2,4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft > xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_GreaterThanTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(4, 1); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft > xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - public void op_GreaterThanTest2() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 4); - bool expected = false; - bool actual; - actual = (xlCellAddressLeft > xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_GreaterThanOrEqual - /// - [TestMethod()] - public void op_GreaterThanOrEqualTest() - { - XLAddress xlCellAddressLeft = new XLAddress(3,3); - XLAddress xlCellAddressRight = new XLAddress(2,4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft >= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_GreaterThanOrEqualTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(4, 1); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft >= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_GreaterThanOrEqualTest2() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 3); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft >= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_GreaterThanOrEqualTest3() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 4); - bool expected = false; - bool actual; - actual = (xlCellAddressLeft >= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Inequality - /// - [TestMethod()] - public void op_InequalityTest() - { - XLAddress xlCellAddressLeft = new XLAddress(1,1); - XLAddress xlCellAddressRight = new XLAddress(1,2); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft != xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_InequalityTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(1, 1); - XLAddress xlCellAddressRight = new XLAddress(1, 1); - bool expected = false; - bool actual; - actual = (xlCellAddressLeft != xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_LessThan - /// - [TestMethod()] - public void op_LessThanTest() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(2, 4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft < xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_LessThanTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(4, 1); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft < xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - public void op_LessThanTest2() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft < xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_LessThanOrEqual - /// - [TestMethod()] - public void op_LessThanOrEqualTest() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(2, 4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft <= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_LessThanOrEqualTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(4, 1); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft <= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_LessThanOrEqualTest2() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 3); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft <= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - [TestMethod()] - public void op_LessThanOrEqualTest3() - { - XLAddress xlCellAddressLeft = new XLAddress(3, 3); - XLAddress xlCellAddressRight = new XLAddress(3, 4); - bool expected = true; - bool actual; - actual = (xlCellAddressLeft <= xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Subtraction - /// - [TestMethod()] - public void op_SubtractionTest() - { - XLAddress xlCellAddressLeft = new XLAddress(6, 3); - uint right = 2; - XLAddress expected = new XLAddress(4,1); - XLAddress actual; - actual = (xlCellAddressLeft - right); - Assert.AreEqual(expected, actual); - } - - /// - ///A test for op_Subtraction - /// - [TestMethod()] - public void op_SubtractionTest1() - { - XLAddress xlCellAddressLeft = new XLAddress(6,3); - XLAddress xlCellAddressRight = new XLAddress(2,1); - XLAddress expected = new XLAddress(4,2); - XLAddress actual; - actual = (xlCellAddressLeft - xlCellAddressRight); - Assert.AreEqual(expected, actual); - } - } -} diff --git a/ClosedXML/ClosedXML_Test/XLWorkbookTest.cs b/ClosedXML/ClosedXML_Test/XLWorkbookTest.cs deleted file mode 100644 index b939215..0000000 --- a/ClosedXML/ClosedXML_Test/XLWorkbookTest.cs +++ /dev/null @@ -1,81 +0,0 @@ -using ClosedXML.Excel; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.IO; - -namespace ClosedXML_Test -{ - - - /// - ///This is a test class for XLWorkbookTest and is intended - ///to contain all XLWorkbookTest Unit Tests - /// - [TestClass()] - public class XLWorkbookTest - { - - - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - #region Additional test attributes - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - //[ClassInitialize()] - //public static void MyClassInitialize(TestContext testContext) - //{ - //} - // - //Use ClassCleanup to run code after all tests in a class have run - //[ClassCleanup()] - //public static void MyClassCleanup() - //{ - //} - // - //Use TestInitialize to run code before running each test - //[TestInitialize()] - //public void MyTestInitialize() - //{ - //} - // - //Use TestCleanup to run code after each test has run - //[TestCleanup()] - //public void MyTestCleanup() - //{ - //} - // - #endregion - - - /// - ///A test for XLWorkbook Constructor - /// - [TestMethod()] - public void XLWorkbookConstructorTest() - { - FileInfo fi = new FileInfo("Test.xlsx"); - XLWorkbook target = new XLWorkbook(fi.FullName); - - Assert.AreEqual(target.Name, fi.Name); - Assert.AreEqual(target.FullName, fi.FullName); - } - } -} diff --git a/ClosedXML/ClosedXML_Test/XLWorksheetsTest.cs b/ClosedXML/ClosedXML_Test/XLWorksheetsTest.cs deleted file mode 100644 index d349068..0000000 --- a/ClosedXML/ClosedXML_Test/XLWorksheetsTest.cs +++ /dev/null @@ -1,99 +0,0 @@ -using ClosedXML.Excel; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; - -namespace ClosedXML_Test -{ - - /// - ///This is a test class for XLWorksheetsTest and is intended - ///to contain all XLWorksheetsTest Unit Tests - /// - [TestClass()] - public class XLWorksheetsTest - { - - - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - public TestContext TestContext - { - get - { - return testContextInstance; - } - set - { - testContextInstance = value; - } - } - - #region Additional test attributes - // - //You can use the following additional attributes as you write your tests: - // - //Use ClassInitialize to run code before running the first test in the class - //[ClassInitialize()] - //public static void MyClassInitialize(TestContext testContext) - //{ - //} - // - //Use ClassCleanup to run code after all tests in a class have run - //[ClassCleanup()] - //public static void MyClassCleanup() - //{ - //} - // - //Use TestInitialize to run code before running each test - //[TestInitialize()] - //public void MyTestInitialize() - //{ - //} - // - //Use TestCleanup to run code after each test has run - //[TestCleanup()] - //public void MyTestCleanup() - //{ - //} - // - #endregion - - - /// - ///A test for XLWorksheets Constructor - /// - [TestMethod()] - public void XLWorksheets_Constructor_Test() - { - var wbExample = new XLWorkbook(@"c:\Example.xlsx"); - XLWorksheets target = new XLWorksheets(wbExample); - - } - - [TestMethod()] - public void XLWorksheets_Count0_Add1_Add2_Delete1_Count1_Test() - { - var wbExample = new XLWorkbook(@"c:\Example.xlsx"); - XLWorksheets target = new XLWorksheets(wbExample); - - Assert.AreEqual(target.Count, 0U); - - target.Add("Sheet1"); - - Assert.AreEqual(target.Count, 1U); - - target.Add("Sheet2"); - - Assert.AreEqual(target.Count, 2U); - - target.Delete("Sheet2"); - - Assert.AreEqual(target.Count, 1U); - - } - } -} diff --git a/ClosedXML/Local.testsettings b/ClosedXML/Local.testsettings deleted file mode 100644 index 49edf89..0000000 --- a/ClosedXML/Local.testsettings +++ /dev/null @@ -1,10 +0,0 @@ - - - These are default test settings for a local test run. - - - - - - - \ No newline at end of file diff --git a/ClosedXML/TraceAndTestImpact.testsettings b/ClosedXML/TraceAndTestImpact.testsettings deleted file mode 100644 index 0792b9b..0000000 --- a/ClosedXML/TraceAndTestImpact.testsettings +++ /dev/null @@ -1,21 +0,0 @@ - - - These are test settings for Trace and Test Impact. - - - - - - - - - - - - - - - - - - \ No newline at end of file