├── OpenXmlUtils
├── packages.config
├── app.Debug.config
├── app.config
├── OpenXmlUtils.nuspec
├── SpreadsheetField Types
│ ├── DecimalNumberField.cs
│ └── HyperlinkField.cs
├── SpreadsheetField.cs
├── NumberCell.cs
├── TextCell.cs
├── FormulaCell.cs
├── DateCell.cs
├── Properties
│ └── AssemblyInfo.cs
├── SheetDefinition.cs
├── OpenXmlUtils.csproj
├── CustomStylesheet.cs
└── Spreadsheet.cs
├── OpenXmlUtils.Tests
├── packages.config
├── app.Debug.config
├── app.Release.config
├── app.config
├── Properties
│ └── AssemblyInfo.cs
├── OpenXmlUtils.Tests.csproj
└── SpreadsheetUnitTest.cs
├── packages
└── repositories.config
├── OpenXmlUtils.sln
├── .gitignore
├── README.md
└── LICENSE
/OpenXmlUtils/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/OpenXmlUtils.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenXmlUtils/app.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenXmlUtils.Tests/app.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenXmlUtils.Tests/app.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenXmlUtils/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OpenXmlUtils.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OpenXmlUtils/OpenXmlUtils.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $title$
7 | $author$
8 | $author$
9 | false
10 | https://github.com/geoplex/openxmlutils
11 | $description$
12 | Copyright 2014
13 | OpenXml DocumentFormat Spreadsheet
14 |
15 |
--------------------------------------------------------------------------------
/OpenXmlUtils/SpreadsheetField Types/DecimalNumberField.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "SpreadsheetField.cs"
4 | // Purpose: "Represents a field in a spreadsheet"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | namespace OpenXmlUtils
24 | {
25 | public class DecimalNumberField : SpreadsheetField
26 | {
27 | public int DecimalPlaces { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/OpenXmlUtils/SpreadsheetField Types/HyperlinkField.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "SpreadsheetField.cs"
4 | // Purpose: "Represents a field in a spreadsheet"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | namespace OpenXmlUtils
24 | {
25 | public class HyperlinkField : SpreadsheetField
26 | {
27 | public string DisplayFieldName { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/OpenXmlUtils/SpreadsheetField.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "SpreadsheetField.cs"
4 | // Purpose: "Represents a field in a spreadsheet"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | namespace OpenXmlUtils
24 | {
25 | public class SpreadsheetField
26 | {
27 | public string Title { get; set; }
28 | public string FieldName { get; set; }
29 | public bool IgnoreFromTotals { get; set; }
30 | public bool CountNoneNullRowsForTotal { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/OpenXmlUtils/NumberCell.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "NumberCell.cs"
4 | // Purpose: "A simple class for number cells"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | using DocumentFormat.OpenXml.Spreadsheet;
24 |
25 | namespace OpenXmlUtils
26 | {
27 | public class NumberCell : Cell
28 | {
29 | public NumberCell(string header, string text, int index)
30 | {
31 | DataType = CellValues.Number;
32 | CellReference = header + index;
33 | CellValue = new CellValue(text);
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/OpenXmlUtils/TextCell.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "TextCell.cs"
4 | // Purpose: "A simple class for text cells"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | using DocumentFormat.OpenXml.Spreadsheet;
24 |
25 | namespace OpenXmlUtils
26 | {
27 | public class TextCell : Cell
28 | {
29 | public TextCell(string header, string text, int index)
30 | {
31 | DataType = CellValues.InlineString;
32 | CellReference = header + index;
33 | InlineString = new InlineString {Text = new Text {Text = text}};
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/OpenXmlUtils/FormulaCell.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "FormulaCell.cs"
4 | // Purpose: "A simple class for formula cells"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | using DocumentFormat.OpenXml.Spreadsheet;
24 |
25 | namespace OpenXmlUtils
26 | {
27 | public class FormulaCell : Cell
28 | {
29 | public FormulaCell(string header, string text, int index)
30 | {
31 | CellFormula = new CellFormula {CalculateCell = true, Text = text};
32 | DataType = CellValues.Number;
33 | CellReference = header + index;
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/OpenXmlUtils/DateCell.cs:
--------------------------------------------------------------------------------
1 | #region File Information
2 | //
3 | // File: "DateCell.cs"
4 | // Purpose: "A simple class for date cells"
5 | // Author: "Geoplex"
6 | //
7 | #endregion
8 |
9 | #region (c) Copyright 2014 Geoplex
10 | //
11 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
12 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
13 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
14 | //
15 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
17 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
18 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
19 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 | //
21 | #endregion
22 |
23 | using System;
24 | using DocumentFormat.OpenXml.Spreadsheet;
25 |
26 | namespace OpenXmlUtils
27 | {
28 | public class DateCell : Cell
29 | {
30 | public DateCell(string header, DateTime dateTime, int index)
31 | {
32 | DataType = CellValues.Date;
33 | CellReference = header + index;
34 | StyleIndex = (UInt32)CustomStylesheet.CustomCellFormats.DefaultDate;
35 | CellValue = new CellValue(dateTime.ToString("yyyy-MM-dd"));
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/OpenXmlUtils.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("OpenXmlUtils.Tests")]
9 | [assembly: AssemblyDescription("A test project for OpenXmlUtils assembly.")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("David McDonald")]
12 | [assembly: AssemblyProduct("OpenXmlUtils")]
13 | [assembly: AssemblyCopyright("Copyright 2014 Geoplex")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("97082b8c-3783-47dc-8aef-e31009c612d1")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/OpenXmlUtils/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("OpenXmlUtils")]
8 | [assembly: AssemblyDescription("Utility classes for the DocumentFormat.OpenXml library.\nCreate a spreadsheet using a collection of objects.\n\nhttps://github.com/geoplex/openxmlutils")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("David McDonald")]
11 | [assembly: AssemblyProduct("OpenXmlUtils")]
12 | [assembly: AssemblyCopyright("Copyright 2014 Geoplex")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("1805f575-682e-4924-8789-d51548134965")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.7")]
35 | [assembly: AssemblyFileVersion("1.0.0.7")]
36 |
--------------------------------------------------------------------------------
/OpenXmlUtils/SheetDefinition.cs:
--------------------------------------------------------------------------------
1 |
2 | #region File Information
3 | //
4 | // File: "SheetDefinition.cs"
5 | // Purpose: "Defines a single sheet (or tab) in a xlxs spreadsheet."
6 | // Author: "Geoplex"
7 | //
8 | #endregion
9 |
10 | #region (c) Copyright 2014 Geoplex
11 | //
12 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
13 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
14 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // IN NO EVENT SHALL GEOPLEX BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
17 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
18 | // RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
19 | // POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
20 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 | //
22 | #endregion
23 |
24 | using System.Collections.Generic;
25 |
26 | namespace OpenXmlUtils
27 | {
28 | public class SheetDefinition
29 | {
30 | ///
31 | /// Name of the sheet (shown in the tab)
32 | ///
33 | public string Name { get; set; }
34 |
35 | ///
36 | /// Title of the sheet
37 | ///
38 | public string Title { get; set; }
39 |
40 | ///
41 | /// Subtitle of the sheet
42 | ///
43 | public string SubTitle { get; set; }
44 |
45 | ///
46 | /// Objects to display in the sheet
47 | ///
48 | public IList Objects { get; set; }
49 |
50 | ///
51 | /// Field names to extract from the objects and use as header names
52 | ///
53 | public List Fields { get; set; }
54 |
55 | ///
56 | /// Whether or not to include a row of calculated totals to the table
57 | ///
58 | public bool IncludeTotalsRow { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/OpenXmlUtils.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.30723.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E36D29A7-0590-4BF2-842D-0BC64265590F}"
7 | ProjectSection(SolutionItems) = preProject
8 | README.md = README.md
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenXmlUtils", "OpenXmlUtils\OpenXmlUtils.csproj", "{5B803DEF-1248-4160-800C-F90287A807B2}"
12 | EndProject
13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenXmlUtils.Tests", "OpenXmlUtils.Tests\OpenXmlUtils.Tests.csproj", "{E5DF0F1A-E559-4355-8A9E-3F6B96050F53}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Debug|x64 = Debug|x64
19 | Release|Any CPU = Release|Any CPU
20 | Release|x64 = Release|x64
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {5B803DEF-1248-4160-800C-F90287A807B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {5B803DEF-1248-4160-800C-F90287A807B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {5B803DEF-1248-4160-800C-F90287A807B2}.Debug|x64.ActiveCfg = Debug|x64
26 | {5B803DEF-1248-4160-800C-F90287A807B2}.Debug|x64.Build.0 = Debug|x64
27 | {5B803DEF-1248-4160-800C-F90287A807B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {5B803DEF-1248-4160-800C-F90287A807B2}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {5B803DEF-1248-4160-800C-F90287A807B2}.Release|x64.ActiveCfg = Release|x64
30 | {5B803DEF-1248-4160-800C-F90287A807B2}.Release|x64.Build.0 = Release|x64
31 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Debug|x64.ActiveCfg = Debug|x64
34 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Debug|x64.Build.0 = Debug|x64
35 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Release|Any CPU.Build.0 = Release|Any CPU
37 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Release|x64.ActiveCfg = Release|x64
38 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53}.Release|x64.Build.0 = Release|x64
39 | EndGlobalSection
40 | GlobalSection(SolutionProperties) = preSolution
41 | HideSolutionNode = FALSE
42 | EndGlobalSection
43 | GlobalSection(NestedProjects) = preSolution
44 | {5B803DEF-1248-4160-800C-F90287A807B2} = {E36D29A7-0590-4BF2-842D-0BC64265590F}
45 | {E5DF0F1A-E559-4355-8A9E-3F6B96050F53} = {E36D29A7-0590-4BF2-842D-0BC64265590F}
46 | EndGlobalSection
47 | EndGlobal
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 | [Dd]ebug/
11 | [Dd]ebugPublic/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | bld/
16 | [Bb]in/
17 | [Oo]bj/
18 |
19 | # MSTest test Results
20 | [Tt]est[Rr]esult*/
21 | [Bb]uild[Ll]og.*
22 |
23 | #NUNIT
24 | *.VisualState.xml
25 | TestResult.xml
26 |
27 | *_i.c
28 | *_p.c
29 | *_i.h
30 | *.ilk
31 | *.meta
32 | *.obj
33 | *.pch
34 | *.pdb
35 | *.pgc
36 | *.pgd
37 | *.rsp
38 | *.sbr
39 | *.tlb
40 | *.tli
41 | *.tlh
42 | *.tmp
43 | *.tmp_proj
44 | *.log
45 | *.vspscc
46 | *.vssscc
47 | .builds
48 | *.pidb
49 | *.svclog
50 | *.scc
51 |
52 | # Chutzpah Test files
53 | _Chutzpah*
54 |
55 | # Visual C++ cache files
56 | ipch/
57 | *.aps
58 | *.ncb
59 | *.opensdf
60 | *.sdf
61 | *.cachefile
62 |
63 | # Visual Studio profiler
64 | *.psess
65 | *.vsp
66 | *.vspx
67 |
68 | # TFS 2012 Local Workspace
69 | $tf/
70 |
71 | # Guidance Automation Toolkit
72 | *.gpState
73 |
74 | # ReSharper is a .NET coding add-in
75 | _ReSharper*/
76 | *.[Rr]e[Ss]harper
77 | *.DotSettings.user
78 |
79 | # JustCode is a .NET coding addin-in
80 | .JustCode
81 |
82 | # TeamCity is a build add-in
83 | _TeamCity*
84 |
85 | # DotCover is a Code Coverage Tool
86 | *.dotCover
87 |
88 | # NCrunch
89 | *.ncrunch*
90 | _NCrunch_*
91 | .*crunch*.local.xml
92 |
93 | # MightyMoose
94 | *.mm.*
95 | AutoTest.Net/
96 |
97 | # Installshield output folder
98 | [Ee]xpress/
99 |
100 | # DocProject is a documentation generator add-in
101 | DocProject/buildhelp/
102 | DocProject/Help/*.HxT
103 | DocProject/Help/*.HxC
104 | DocProject/Help/*.hhc
105 | DocProject/Help/*.hhk
106 | DocProject/Help/*.hhp
107 | DocProject/Help/Html2
108 | DocProject/Help/html
109 |
110 | # Click-Once directory
111 | publish/
112 |
113 | # Publish Web Output
114 | *.[Pp]ublish.xml
115 | *.azurePubxml
116 |
117 | # NuGet Packages Directory
118 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
119 | packages/*
120 | ## TODO: If the tool you use requires repositories.config, also uncomment the next line
121 | !packages/repositories.config
122 |
123 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
124 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
125 | !packages/build/
126 |
127 | # Windows Azure Build Output
128 | csx/
129 | *.build.csdef
130 |
131 | # Windows Store app package directory
132 | AppPackages/
133 |
134 | # Others
135 | *.Cache
136 | ClientBin/
137 | [Ss]tyle[Cc]op.*
138 | ~$*
139 | *~
140 | *.dbmdl
141 | *.dbproj.schemaview
142 | *.pfx
143 | *.publishsettings
144 | node_modules/
145 |
146 | # RIA/Silverlight projects
147 | Generated_Code/
148 |
149 | # Backup & report files from converting an old project file to a newer
150 | # Visual Studio version. Backup files are not needed, because we have git ;-)
151 | _UpgradeReport_Files/
152 | Backup*/
153 | UpgradeLog*.XML
154 | UpgradeLog*.htm
155 |
156 | # SQL Server files
157 | App_Data/*.mdf
158 | App_Data/*.ldf
159 |
160 | # Business Intelligence projects
161 | *.rdl.data
162 | *.bim.layout
163 | *.bim_*.settings
164 |
165 | # Microsoft Fakes
166 | FakesAssemblies/
167 |
168 | # =========================
169 | # Windows detritus
170 | # =========================
171 |
172 | # Windows image file caches
173 | Thumbs.db
174 | ehthumbs.db
175 |
176 | # Folder config file
177 | Desktop.ini
178 |
179 | # Recycle Bin used on file shares
180 | $RECYCLE.BIN/
181 |
182 | # Nuget files
183 | *.nupkg
--------------------------------------------------------------------------------
/OpenXmlUtils/OpenXmlUtils.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5B803DEF-1248-4160-800C-F90287A807B2}
8 | Library
9 | Properties
10 | OpenXmlUtils
11 | OpenXmlUtils
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | TRACE;DEBUG;LOCALHOST
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE;LOCALHOST
31 | prompt
32 | 4
33 |
34 |
35 | bin\DEV\
36 |
37 |
38 | bin\PROD\
39 |
40 |
41 | bin\UAT\
42 |
43 |
44 | x64
45 | bin\x64\Debug\
46 |
47 |
48 | x64
49 | bin\x64\Release\
50 |
51 |
52 | x64
53 | bin\x64\DEV\
54 |
55 |
56 | x64
57 | bin\x64\PROD\
58 |
59 |
60 | x64
61 | bin\x64\UAT\
62 |
63 |
64 | bin\HOTFIX\
65 | AnyCPU
66 | MinimumRecommendedRules.ruleset
67 | HOTFIX
68 |
69 |
70 | bin\x64\HOTFIX\
71 | x64
72 | MinimumRecommendedRules.ruleset
73 | HOTFIX
74 |
75 |
76 | $([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.12\tools\))
77 | true
78 | $([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))
79 | $(SlowCheetah_NuGetImportPath)
80 |
81 |
82 | true
83 | bin\TestAccount\
84 | TRACE;DEBUG;LOCALHOST
85 | full
86 | AnyCPU
87 | prompt
88 | MinimumRecommendedRules.ruleset
89 |
90 |
91 | true
92 | bin\x64\TestAccount\
93 | x64
94 | MinimumRecommendedRules.ruleset
95 |
96 |
97 |
98 | False
99 | ..\packages\DocumentFormat.OpenXml.2.5\lib\DocumentFormat.OpenXml.dll
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | true
126 |
127 |
128 | app.config
129 | True
130 |
131 |
132 | Designer
133 |
134 |
135 |
136 |
137 |
138 |
139 |
146 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OpenXMLUtils
2 | ============
3 |
4 | Utility classes for the [Open XML SDK 2.5 for Office](http://msdn.microsoft.com/en-us/library/office/bb448854.aspx).
5 |
6 | Copyright (c) Geoplex All rights reserved.
7 | Licensed under the Apache License, Version 2.0.
8 | See License.txt in the project root for license information.
9 |
10 | Package
11 | =======
12 |
13 | https://www.nuget.org/packages/OpenXmlUtils/
14 |
15 | Documentation
16 | =============
17 |
18 | Currently supports creation of simple spreadsheets from a collection of objects based on this:
19 | http://www.codeproject.com/Articles/97307/Using-C-and-Open-XML-SDK-for-Microsoft-Office.
20 |
21 | ##Example Usage
22 |
23 | Using a list of objects:
24 | ```c#
25 | var songs =
26 | new List
27 | { new Song { Artist = "Joy Devision", Title = "Disorder", Date = DateTime.Today, TimeSpan = TimeSpan.FromSeconds(3343), Int = 89453312L, Double = 4043.4545, Bool = false },
28 | new Song { Artist = "Moderate", Title = "A New Error", Date = DateTime.Today, TimeSpan = TimeSpan.FromSeconds(34345), Int = 89563312L, Double = 5.6, Bool = true },
29 | new Song { Artist = "Massive Attack", Title = "Paradise Circus", Date = DateTime.Today + TimeSpan.FromDays(53), TimeSpan = TimeSpan.FromSeconds(545), Int = 344334L, Double = 222.3, Bool = false },
30 | new Song { Artist = "The Horrors", Title = "Still Life", Date = DateTime.Today - TimeSpan.FromDays(1), TimeSpan = TimeSpan.FromSeconds(22345), Int = 9497934L, Double = 33.4634444, Bool = true },
31 | new Song { Artist = "Todd Terje", Title = "Inspector Norse", Date = DateTime.Today - TimeSpan.FromDays(356), TimeSpan = TimeSpan.FromSeconds(5565), Int = 34211343L, Double = 54.44444, Bool = false },
32 | new Song { Artist = "Alpine", Title = "Hands", Date = DateTime.Today - TimeSpan.FromDays(5.5), TimeSpan = TimeSpan.FromSeconds(9907), Int = 32323333L, Double = 3445.44, Bool = false },
33 | new Song { Artist = "Parquet Courts", Title = "Ducking and Dodging", Date = DateTime.Today - TimeSpan.FromDays(88.55), TimeSpan = TimeSpan.FromSeconds(8877), Int = 8088872L, Double = 44.0, Bool = false },
34 | };
35 |
36 | var fields = new List
37 | {
38 | new SpreadsheetField{ Title = "Artist", FieldName = "Artist"},
39 | new SpreadsheetField{ Title = "Title", FieldName = "Title"},
40 | new SpreadsheetField{ Title = "RandomDate", FieldName = "Date"},
41 | new SpreadsheetField{ Title = "RandomTimeSpan", FieldName = "TimeSpan"},
42 | new SpreadsheetField{ Title = "RandomInt", FieldName = "Int"},
43 | new SpreadsheetField{ Title = "RandomDouble", FieldName = "Double"},
44 | new SpreadsheetField{ Title = "RandomBool", FieldName = "Bool"}
45 | };
46 |
47 | Spreadsheet.Create(@"C:\temp\songs.xlsx",
48 | new SheetDefinition
49 | {
50 | Fields = fields,
51 | Name = "Songs",
52 | SubTitle = DateTime.Today.ToLongDateString(),
53 | IncludeTotalsRow = true,
54 | Objects = songs
55 | });
56 | ```
57 |
58 | Using a list of dictionaries:
59 | ```c#
60 | var songs =
61 | new List